(from Wikipedia)
On August 2, 1876, while playing poker at Nuttal & Mann's "Saloon No. 10" in Deadwood (then part of the Dakota Territory but on Indian land), Hickok could not find an empty seat in the corner, where he always sat in order to protect himself against sneak attacks from behind, and instead sat with his back to the door; unfortunately, his previous caution proved wise, as he was shot in the back of the head with a .45-caliber revolver by Jack McCall. Legend has it that Hickok's hand in poker was a Pair of Aces, and a pair of Eights, with the fifth card disputed. The fifth card was either unknown, or some say that it was not dealt yet, and the game was interrupted by Hickok getting shot.
The motive for the killing is still debated. McCall may have been paid for the deed, it may have just been the result of a recent dispute. But most likely, McCall, in a drunken rage, became enraged over what he perceived as a condescending offer from Hickok to let him have enough money for breakfast after he had lost all his money playing poker the previous day. McCall claimed at the resulting two-hour trial (by a motley group of assembled miners and businessmen) that he was avenging Hickok's earlier slaying of his brother and was acquitted, resulting in the Black Hills Pioneer editorializing:
"Should it ever be our misfortune to kill a man ... we would simply ask that our trial may take place in some of the mining camps of these hills"
McCall was subsequently rearrested after bragging about his deed, and a new trial was held. The authorities did not consider this to be double jeopardy because Deadwood at the time was an illegal city due to several laws that made it against the law to settle on Indian land, although many people did anyway. The new trial was held in American territory, in Yankton, South Dakota. Hickok's brother, Lorenzo Butler Hickok, traveled from Illinois to attend the retrial. This time McCall was found guilty and hanged. After his execution it was determined that McCall had never even had a brother.