Why does Madara give his Rinnegan to Nagato? Madara had already activated the Rinnegan since he is an Uchiha and also has the DNA of the first Hokage. But why does he give it to Nagato?
Madara didn't actually give it to Nagato. When Nagato was young, Madara transplanted the Rinnegan onto Nagato, without his knowledge.
Madara had achieved the Rinnegan near to end of his physical life. So he decided that would have to die someday as his body was nearing the end. As a plan to be revived later on, he transplanted his eyes onto an Uzumaki individual. This was Nagato. Uzumaki clan was known for their huge chakra reserves, so the user of the Rinnegan could tap into its original power because of their chakra levels.
So he transplanted his Rinnegan into a young Nagato without the boy's knowing, intending Nagato to someday use the eyes to restore Madara to life. If Nagato was to do this, however, Madara would need an agent to act on his behalf and guide Nagato towards this ultimate goal. Madara waited, connecting himself to Demonic Statue to keep him alive until someone could be found.
He then found Obito in the ruins and decided that he will be the one to lead Nagato to use the Samsara of Heavenly Life to bring him back to life.
Source: Naruto Wikia