How does Edo Tensei Madara get back his Rinnegan? Madara gave his Rinnegan to Nagato. But after Kabuto brings him back using Edo Tensei, he still has the Rinnegan. How is this possible?
Narutopedia:


  A reincarnated individual will have all the abilities they had during their life, including kekkei genkai and kekkei tōta. They are psychically restored as they were at the time of their death, including any physical handicaps they may have possessed, such as Nagato's damaged legs.


Since Madara had the Rinnegan when he died, he is resurrected with it again (with the help of Kabuto's modifications, if you remember).

However, the Edo Tensei Rinnegans are fake. Although Edo Tensei Madara can use them to absorb ninjutsu, he can't use it to summon the Gedo Mazo, or use Limbo. It's kinda the same with Nagato's Rinnegan or Itachi's Mangekyo Sharingan.

For further proof, when Madara was revived in flesh through Rinne Rebirth, he lost his fake Rinnegan.