Nagato, also known as Pain, was a member of the Uzumaki clan who suffered greatly during the Third Shinobi War. He sought to end all wars and bring peace to the world by obtaining the Rinnegan, a powerful dōjutsu that was believed to only exist in myth. Nagato formed the Akatsuki with his friends Yahiko and Konan, but his beliefs evolved over time, and he began to see the need for a more drastic solution.

Nagato was a member of the Uzumaki clan, which was known for its strong chakra and sealing techniques. He was orphaned at a young age during the Third Shinobi War, where he witnessed first-hand the devastation and suffering caused by the conflict. Nagato’s experiences during the war deeply affected him, leading him to seek out a way to end all wars and bring peace to the world.
Nagato met a man named Jiraiya, a legendary ninja and member of the Leaf Village. Jiraiya saw potential in Nagato and his two friends, Yahiko and Konan, and trained them in ninjutsu. Together, the three formed a group called the Akatsuki, which initially sought to bring peace to the war-torn land through force.
However, Nagato’s beliefs evolved over time, and he began to see the need for a more drastic solution to bring about peace. He came to believe that a single person with god-like powers could bring about true peace by instilling fear in others and preventing any further wars from occurring.
To this end, Nagato sought out the Rinnegan, a powerful dōjutsu that was believed to only exist in myth. The Rinnegan was said to be the most powerful of all the dōjutsu, allowing its user to control all six types of chakra and even summon the powerful creatures known as the Six Paths of Pain.
Nagato learned that the Rinnegan had once belonged to the Sage of the Six Paths, the legendary ninja who was said to have founded the shinobi world. Nagato believed that if he could obtain the Rinnegan, he could become the next Sage of the Six Paths and use his god-like powers to bring about peace.
Nagato eventually discovered that the Rinnegan was not a myth, but a real dōjutsu that had been passed down through the Uchiha and Senju clans. He learned that the Uchiha leader, Madara Uchiha, had possessed the Rinnegan before his death and had passed it on to his successor, Obito Uchiha.
Obito Uchiha later gave the Rinnegan to Nagato, believing that he was the only one capable of using its power to bring about true peace. With the Rinnegan, Nagato was able to summon the Six Paths of Pain, which were six corpses that he had imbued with chakra and controlled using the Rinnegan.
Nagato’s use of the Six Paths of Pain and the Rinnegan ultimately led to his downfall. He was defeated by the series’ main character, Naruto Uzumaki, who was able to convince Nagato that true peace could only be achieved through understanding and forgiveness, not through fear and force.
In conclusion, Pain, also known as Nagato, obtained the Rinnegan through a series of events in the Naruto anime and manga series. Nagato’s experiences during the Third Shinobi War led him to seek out a way to bring peace to the world, and he came to believe that the Rinnegan was the key to achieving his goal. Through his training with Jiraiya and the formation of the Akatsuki, Nagato ultimately obtained the Rinnegan from Obito Uchiha and used its power to control the Six Paths of Pain. However, his use of the Rinnegan ultimately led to his defeat and his realization that true peace could only be achieved through understanding and forgiveness.