Hello, and welcome! :)
I am in 100% agreement with LSiT’s theory on this. Essentially: Jim employs a ton of snipers/assassins, particularly in TRF. When Mycroft shows John the files of the assassins moving in on Baker Street, one is a blond Russian woman with a tattoo (recorded in her files) Her picture is visible and it’s not Mary, but it’s easy to see a parallel, as we know from Sherlock’s deductions that she has a secret tattoo, she is possibly not English, and of course, she’s blond. (And an assassin. ;)
(The fact that John doesn’t recognize the two male assassins from their photos, but admits to Mycroft he’s noticed the female one around, is a bit of foreshadowing – he’ll take notice of another blond assassin in Sherlock’s absence.)
Jim went to the roof knowing Sherlock had set up a plan to fake his suicide. Jim did the same thing. He had three snipers/assassins on Lestrade, Hudders, and John – and a fourth on himself. Mary.
Jim shaking Sherlock’s hand is the signal. That’s why Sherlock looks confused when Jim holds his hand out – it’s a weird thing to do. And Jim’s movement is very, very deliberate.
And that’s why we get the close-up, because this moment is important:
Jim is sealing his and Sherlock’s fake-fates.
Mary sees the signal and aims. Jim says “good luck with that,” pulls out a fake and/or unloaded gun, sticks it in his mouth, and…PAUSES.
See how he waits? It’s Sherlock who backs away, and the camera follows him. You can see Jim blink. Watching, enjoying Sherlock’s look of horror, staying perfectly still so Mary can take the shot. He’s got a pouch of fake blood under his turned-up collar, just behind his neck. He knows Mary can hit that pouch from a side angle without hurting him.
Mary makes the shot, crack, the pouch bursts and Jim falls back.
We see no brain, no fragments of skull, none of the gore that is present when someone has actually stuck a gun in their mouth and pulled the trigger. Instead:
The pouch leaks and Jim lays there and tries not to giggle. Is he really going to get away with this? Is Sherlock not going to check him for a pulse, for any signs of life? (Because Jim sure would like him to…)
Too easy, it’s too easy!
Sherlock glances back. There’s a reason we’re at this angle, with Sherlock blocking part of the shot. We, like Sherlock, aren’t seeing the full picture.
But we can see enough. That is not what someone who blows the back of his head out looks like.
And here’s the thing: this isn’t a gory show. Horrible murders are committed, but we don’t really see gore. Take Magnussen’s shot in the head, which was real:
So they kept it distant intentionally. To show us that yes, Sherlock shot him, but to avoid showing the up-close gore. But with Jim, they focus on his head and the trickling blood. Because it’s fake, and because they planned to bring Jim back all along, they knew when they filmed this part they would have to show us it was fake, and not intentionally block his body or show it from a distance. That’d be cheating. We have to see what Sherlock sees.
The last shot of Jim they give us is this:
His hand is still holding the gun. That’s one clingy corpse. (Seriously though – look at his fingers. It’s not just that the gun is in his hand: his fingers are still wrapped around it. #NotDead)
Of course, the sniper doesn’t have to be Mary. Except it really kind of does. Why?
Because you won’t love me when you’re finished.
Mary says this to John after he’s learned she’s an assassin, and after he discovers she’s shot and nearly killed Sherlock. Yet somehow, there is actually something else in her past that is worse than damn near murdering John’s best friend which, were he to discover it, would make him stop loving her (in her opinion). So what could that be? What is more terrible than almost murdering Sherlock?
Mary helped Jim fake his death. Which means she played a role in forcing Sherlock’s fake suicide. Which means she’s always known both Sherlock and Jim are alive. Which means John spent all that time grieving and crying about his dead best friend on the shoulder of a woman who not only knew he was alive, but was partially responsible for taking him away from John in the first place.
She did all that, and then she shot Sherlock in the chest.
So yeah. Pretty sure John will be finished with her when he finally does learn the truth.