In my Opinion Madara was jealous of Hashirama's wife (an uzumaki) of what secrets her clan had. So he wanted to meet one for himself. He searched for one and then he found Nagato.
You should know its not in a little kids nature to kill someone.
I really think this happened.
Madara discovered one of the Rinnegans abilities was the power of ressurrection . Knowing he will die soon. Madara rushed to find an Uzumaki. Not a grownup that will disobey him. I doubt he used genjutsu on nagato. Since Nagato did'nt revive him.
Madara finds a kid with red hair knowing that's the Uzumaki's trademark. He spills the beans to nagato about his plans and revealing his identity. Since its not in an Uzumakis Nature to ever join the bad side. Nagato accepted Madara's Rinnegan, killed him with one of the Rinnegans abilities, and chose not to ressurect him.