ok this is my totally awesome theory of how Nagato got his rinegan: i believe nagatos rinegan eyes were madara's eyes. we all know that madara eventually died for some reason, not before making sure that we would someday be brought back to life, this was obito's job to makesure it happened. this was so because as we shoull have notice one someone is brought to life with edo tensei they are revived with their eyes intact, even if their eyes have been damage or removed in battle while still alife. tobi being a bi-polar freak who got so brainwashed by madara himself while still young, eventually came to believe he was madara himself, it seems tobi had no intention of reviving madara so he would play the role good taking the credit for everything madara did while alife. so madara gave his very own eyes to toby who eventually used Nagato as a vessel to keep the rinnegan safe. madara might even have died on purpose knowing that once he came back to life he would be really invincible, with a chakra an a new brand ocular powers that were never ending, but eventually obito became a master mind of evilness and decided that he should be the one to control the whole world using the moon's eye plan (perhaps this was madara's original plan).