I don't want to give away too many of the twists and turns in how Pinkerton did this. It is a good spy story, I think it would make a great movie. But I can share some of the back story. Pinkerton was hired by one of the railroads that ran thru Maryland (name of which escapes me at the moment) but the railroad owner was worried about the secessionists damaging his railroad, either as part of a plot to prevent troops, or Lincoln, from reaching DC or as just simple destruction.
Pinkerton got his network of spies in the area and slowly they uncovered that there was a plot in Baltimore that was much greater than destroying a railroad, they were going to try to kill the president. Once they fleshed out enough of the plot to know real particulars Pinkerton then faced the daunting prospect of making Lincoln believe it, while on a railroad tour that was getting closer to Baltimore everyday. Time was of the essence and obviously Pinkerton pulled it off in the nick of time.
In some respects that's the tough part of the book. We all know that Lincoln is going to get through Baltimore safe. Most of us also know that he did change his plans at the last minute and slipped through town in the middle of the night instead of following the publicized plan. We all know the conclusion of the story but it is a fascinating story to get that to that already known conclusion.