Well the manga clearly states these facts upfront:
1)Nagato awakened his rinnegan first when his parents died.
2)Madara was not in possesion of rinnegan when he battled Hashi.
3)Rinnegan has the power to bring back the dead.
4)Tobi "claims" to have given the rinnegan to nagato.
5)madara...