Pain (Nagato) was arguably the most interesting and philosophical character in the Naruto universe. Might even say he’s THE best written antagonist throughout anime. His philosophy actually made sense. Whether or not you agree with his methods, his philosophy was quite accurate.
If one does not experience pain similar to someone else then they will never truly understand.
Therefore, by inflicting the same pain onto others that was once inflicted onto him, he hoped for people to understand each other. These methods would not only evoke empathy, but become the catalyst to achieve peace.
He then subjected to Naruto the question, What is justice? Pain’s dialogue in my opinion was the best dialogue in Naruto Shippuden. Why? Because it made the viewers look at both the “heroes” and “villains” actions side by side. Comparing the two, you would recognize that both of their actions were ultimately similar. The only difference is the other one would preach it’s for “justice” while the other is doing it because we, the audience, have been convinced he/she is “evil” and merely doing it in spite.
Essentially, pain is what makes us different. If we do not experience the same pain then how can we hope to relate and empathize with others? We could perhaps sympathize with them but we would never truly know what they’re feeling…