In "The Reichenbach Fall", we learn that several hired assassins have moved into the apartments surrounding the one John and Sherlock share. They actually save Sherlock from getting hit by cars a few times, and then when Sherlock shakes their hands, they are instantly shot by... other snipers in the area.
I was convinced that when Sherlock shook Moriarty's hand at the end, Moriarty would be shot in a similar manner - that Sherlock's handshake was the signal to these invisible snipers that the recipient should be shot.
But that didn't happen. Moriarty shot himself. (So the only way my theory could have been correct is if Moriarty had been the sniper the other two times Sherlock shook hands with people in the episode. Which is impossible, since one occurred right after Moriarty drove away in a cab.)
Basically, I am confused about the purpose of these characters. Were these assassins hired to protect Sherlock or to kill him? Were they the same ones who were hired to take out John, Mrs. Hudson, and Lestrade? If so, why did they need to be killed just for shaking hands with Sherlock?