For getting under the skin of Deadwood, three books are essential.
Deadwood by Pete Dexter (1986) — a darkly funny historical novel that follows Charlie Utter trying to get Wild Bill Hickok's body back to Cheyenne. Dexter is unsentimental about the squalor of the gold camp and is much truer to the actual texture of frontier life than the legend. Several scenes from the HBO series clearly draw on it.
The Black Hills: An American Journey by Joe Starita — a journalist's traverse of the Black Hills, from Mount Rushmore to Crazy Horse to Wounded Knee, weaving together Lakota perspectives, the Indian Wars and the gold rush. Reading it before a visit forces you to reckon with what the rush actually cost.
Calamity Jane: The Woman and the Legend by James D. McLaird — a careful scholarly biography that strips away the dime-novel mythology and presents the actual hard-drinking, often destitute Martha Canary. Reading it next to the romantic narrative in Deadwood's tourist literature is salutary.