After the Brexit vote, Cameron announced he would be stepping down in October.
Why is he waiting so long? Surely a transition does not take 4 months.
The reason for the delay is the Conservative election process needs to be completed before he actually steps down. He wanted the new leader to be in place before the Conservative Conference in October, but has recently stated that the new leader will probably be in place by 2nd September.
The mechanics of the Conservative Leadership election are not too complicated.
Between the time the Nominations close and the actual member election there needs to be a period of hustings and debate.
The above process was used for David Cameron's election in 2005.
So to answer the question, he doesn't want the Party without a leader, or the country without a Prime Minister, during a time of huge instability and it could take until October for that process to be complete.
David Cameron was in the "Remain" camp and therefore didn't feel it was just for him to lead the UK during the exit from the EU.
David Cameron has also said that there will be no second Referendum whilst he is Prime Minister and him stepping down may open the way for a second Referendum to happen under a new PM as he is opening the way for another Prime Minister to come. He is also, in a way, force a General Election where the primary onus will be the respective political parties stance on the result of the Referendum.
The reason I think he is leaving several months later is so that he can consolidate the Conservative Party internally - if his immediate resignation was effective immediately, it would leave the United Kingdom without a leader - in a period of history where there is create political turmoil. David Cameron probably thinks that giving the UK a few months grace until he eventually steps down will help stabilise not only the UK's market but also his own political party.