Sherlock is on the roof, he places the call, talks to Watson, throws the phone and jumps. Watson sees him jump and fall, but does not see him land. We, the audience, see a body hit the floor (no face visible) but John doesn't. This body hitting the floor is not Sherlock, but the corpse procured by Holly, having been rolled out of the truck in front of the building. Holmes lands in this very truck that is filled with (visible) garbage bags and presumably padding. The shot immediately following is of Watson running forward and looking around the corner, where he sees the corpse lying on the floor, highlighting the fact that from where he was previously standing he could not see the impact. The "random" bicyclist then hits Watson.
When Watson is hit, the crowd of random bystanders that appeared out of nowhere moments earlier (Moriarty remarks that there is an audience gathering) are obscuring the view of the corpse. I'd put money on them being a part of the act, possibly Sherlock's homeless network that gets a mention earlier in the episode without any real necessity. Sherlock switches with the corpse that John saw on the floor, and plays dead. The corpse is put back onto the back of the truck, and it's at this point we see the truck pulls away. Watson now looks up, stumbles to his feet and over to Holmes who is now playing dead, but Watson insists on checking on his fallen friend (as Sherlock would deduce, as John's a doctor). Watson checks Sherlock's pulse (easy enough to fake) and it's here that we are shown Sherlock's face, confirming that Sherlock would have had to have switched back with the corpse.
Now, what I haven't been able to put together is how exactly Sherlock would know that the confrontation with Moriarty would end with him having to take his own life, but it is Sherlock after all. However, there are a few points that lend credit to the fact that Sherlock not only knew what his fate was, but was planning for it. First, when confronting Molly before he tells her he needs her, he remarks that he's going to die. Nothing would suggest this, in fact up until this point Sherlock correctly deduces the fact that Moriarty is planning to kill his reputation - not him. Second, he gets someone to call John away under the false pretence that Mrs. Hudson has been shot, that opens up a window for Sherlock to put his plan in place/meet Moriarty without suspicion. Finally, Sherlock sets the meeting place, Bart's Hospital rooftop. Convenient, as Molly works in the morgue.