I still don't understand why Bojo didn't go for it after Cameron resigned (Brexit vote), Leave won, it was perfect him to put his name forward in the Leader contest, surely?
So why now?
He did. Then Gove (his major backer) stabbed him in the back saying he didn't believe he could do it and ran himself (only to pull out days later). This made Boris look silly and he withdrew. Boris wasn't really a Leaver (beforehand he quite often, in muted terms, was in favour of the EU) - he was always just going to take the opposite position to Cameron so if Cameron lost it'd trigger a leadership election (which it did). Boris doesn't give a fuck about people, the country or even the Conservatives really - it's all about his own personal ambition and what will help him achieve it. If someone said he'd never be PM as a Tory but was guaranteed the job under Labour I wouldn't be at all surprised to see him switch at the drop of a hat.
It was probably best for him long-term and anyone else and anyone with half an ounce of common sense wouldn't have gone near the job at that point - there was no way to win and getting a deal would be nigh impossible because everyone would have a reason to not like the deal put forward. No-one was going to compromise because by then you've just ended up with something similar to what you already had and made the entire thing pointless.
That's why Cameron walked away - he knew it was a hiding to nothing and whatever stick he got historically for calling the referendum and then walking away would be way better than sticking around and being in charge of the inevitable shitstorm to follow. Personally I'd love for Farage be asked to take over just so he can be proven to be the ignoramus he clearly is, but after that Mogg for the wake up call he'd get on how the world operates now. I don't want to give Boris the satisfaction of the prestige but at least it'd pierce that likeable posh idiot persona people fall for.