McKinley's assassination led to Teddy Roosevelt becoming president, though for a time it looked as if McKinley might pull through. He and Mrs. McKinley had attended the Pan-American Exposition in Buffalo, New York on September 5, 1901, where he delivered a speech about tariffs and foreign trade. The next morning, he went to Niagara Falls and returned to the Expo that afternoon McKinley. He was at the Temple of Music, greeting the public. There, Leon Frank Czolgosz waited in line with a pistol in his right hand concealed by a handkerchief. At 4:07 p.m. Czolgosz shot McKinley twice. The first bullet just grazed the president's shoulder, but the second went through McKinley's stomach, pancreas, and kidney, and finally lodged in the muscles of his back. The president whispered to his secretary, George Cortelyou “My wife, Cortelyou, be careful how you tell her, oh be careful.”
Czolgosz tried to fire again, but he was overpowered by an enraged crowd. McKinley called out "Boys! Don't let them hurt him!" but the angry crowd beat Czolgosz severely.
One bullet was easily found and removed, but doctors were unable to locate the second bullet and were afraid that the search for the bullet might cause more harm than good. McKinley appeared to be recovering, so doctors decided to leave the bullet where it was.
Thomas Edison offered the use of his newly invented x-ray machine which was displayed at the fair, but doctors were reluctant to use it because they did not know what side effects it might have. The operating room at the exposition's emergency hospital did not have any electric lighting and the surgeons were unable to operate by candlelight because of the danger created by the flammable ether used to keep the president unconscious.
McKinley's doctors believed he would recover, and the President convalesced for more than a week in Buffalo at the home of John Milburn. the exposition's director. On the morning of September 12, he felt strong enough to receive his first food orally since the shooting but by afternoon his condition rapidly worsened and he began to go into shock. McKinley died on September 14, 1901 at 2:15 a.m., eight days after he was shot, he died from gangrene surrounding his wounds. He was 58.
McKinley's last words were "It is God's way; His will be done, not ours." He was originally buried in West Lawn Cemetery in Canton, Ohio, in the receiving vault. His remains were later reinterred in the McKinley Memorial, also in Canton.
Czolgosz was tried and found guilty of murder, and was executed by electric chair at Auburn Prison on October 29, 1901.