Ok, my theory has one weakness. I can’t trick you into forgetting that question, it will pop out eventually, so I will admit it right away: I have no idea how he did it.
The Sage of the Six Paths IS Tobi. Somehow he stood up from his deathbed, and then it’s totally clear. He wanted a peaceful world and he wanted to know if the world turns into a peaceful place. He stayed on “Earth” and looked how it turns out and he had still his ace, the mooneye plan, if the world turns out evil. The mooneye plan is the only way to bring peace to the whole world, so basically the So6P vision. Plus that is the only consistent way to stop Edo Madara.
One possibility of his survival would be, that he just manipulated the history (no magic, just changing a few things, or write the book by himself^^) and didn’t die. And in the end, he is the god damn So6P, he can do whatever he wants. If Oroshimaru can live for like billion years, the So6P could be immortal and just switch from a spiritual state to a physical on his will.
In addition, look how strong tobi is, and he hasn't shown his full power yet!
