Arguably, the whole book is working up to Harry's decision to voluntarily give up his own life, in order to destroy the last Horcrux of Voldemort inside him. This it seems Dumbledore could never bring himself to do-do; not just because of any personal feelings he had for Harry, but due to the fact that it was Harry himself, after a fashion, who had been responsible for defeating Voldemort the first time.
Harry was famous for being instrumental in saving everyone before the books began; no one in the Order of the Phoenix would have consented to, nor permitted him to be killed. He was, after all, everyone's hope. They could not bear it. Also the existence of the Horcrux inside him was, as far as we know, kept a great secret from everyone lest Voldemort find out through Legilimency.
So. Dumbledore, ever thinking ahead-, knew that only through Harry's own process of self-discovery, alone...., as well as by going through the lengthy and considerable challenge of finding and destroying the other remaining Horcruxes, would Harry come to build up the resolve and courage for his final, selfless act.
Had Dumbledore not died, or been there all along advising him through portraits, making things easy...., it's likely he would not have had the determination to carry through, which he had at the end.