On September 6, 1901, President William McKinley was shot while attending the Pan-American Exposition in Buffalo, New York. Leon Czolgosz, a Polish citizen associated with the Anarchist movement, fired two shots at McKinley who was greeting the public in a receiving line.
McKinley died September 14, whispering the words of his favorite hymn, “Nearer my God to Thee, Nearer to Thee.” He was succeeded by his vice president, Theodore Roosevelt.
— Source Library of Congress.
Czolgosz died in the electric chair.
See The New York Times articles from the day of the shooting.