Using Nagato's power, he can revive the dead. I saw him reviving Pain's member everytime someone die (except for the reviver member of course). He also revive a lot of people he killed in Konoha. But I don't understand why didn't he revive Yahiko then?
I was thinking he discovered the reviving jutsu after a while Yahiko died, and some soul cannot be revive after a long time of being dead. But that idea removed when I think about how Madara revive himself.