The episode is full of tiny details that are easily overlooked. I totally failed to spot that there was briefly a rubbish truck parked at the foot of the building. It then disappears. It's on screen for a scant couple of seconds.
There's also the scene where he first encounters the girl. Why would she scream if she's never met him before? Except maybe she has. Or maybe she's met someone who looks very much like him. Now it seems to me that what happens, is that some how he gets hold of this doppleganger. And it's him that we see lying in a pool of blood.
Molly is crucial in this plan. I found it odd at the time that Moriaty was only planning on killing just 3 of his friends. Why wouldn't he kill Molly? Because he doesn't know that Molly and Sherlock are friends? And since his knowledge of who Sherlock is friends with comes from Mycroft, that means that it's concievable that Mycroft was in on the plan too and that it stretches back far further than we could possibly begin to imagine.
So Sherlock arranges to meet with Moriaty on top of the hospital, whilst Molly lures away Watson, arranges for the rubbish truck to end up parked at the foot of the building where she waits with the dead doppleganger. Now I'm not sure if Watson was expected to come back. Sherlock does seem a little surprised to see him. But he then ensures to position him so that there's a low building inbetween him and where the truck is parked. Although Watson's assassin is setting himself up outside the hospital, so maybe it is all planned?
Anyway. Sherlock gets Watson to stand in just the right spot to witness him jumping off, but not see him land. He jumps and lands in the rubbish truck. Molly pushes the doppleganger's corpse out so that it's sprawled on the pavement and the truck drives off. Watson arrives in time to find a crowd of medical types clustered around the body and is only really given a short amount of time to even see that it's Sherlock or not.
I think the cyclist was a random event. Moriaty's own death is a bit odd. Possibly he realises that Sherlock is like him in the sense that he's not afraid of getting his hands dirty. After all, that doppleganger had to die somehow. And Moriaty couldn't have done it or he'd risk it being discovered and someone going "Hey, that looks just like Sherlock". Which might have caused a few too many unanswered questions.
The code part of the plot was very silly. I have to hope that Sherlock was stringing Moriaty along by believing in it. The assassins sent to live nearby, I'm guessing, is Moriaty's way of ensuring that Sherlock lives long enough for his downfall? But who else is gunning for him to put him at such risk? Maybe that's something/one we'll encounter in season 3?