This The technique is based on an ability the Sage of the Six Paths had, the Creation of All Things (万物創造, Banbutsu Sōzō). The process he used is explained to have initially involved the administration of imagination, and the spiritual energy which forms the basis of Yin chakra to create shape and form from nothingness. Then, through the application of vitality, and the physical energy which forms the basis of Yang chakra, he would breathe life into the prior form. Thus, a technique with the power to turn imagination into reality was born, known as Izanagi.
To make full use of Izanagi, users must also have the genetic traits of the Senju, who are also descended from the Sage. For this reason Danzō had some of Hashirama Senju's DNA transplanted into his arm, which had the added benefit of increasing his physical energy and vitality. Madara Uchiha also makes use of Hashirama's DNA, though he claims to have gained control of it, unlike Danzō. Perhaps because of this reason, Madara is able to sustain Izanagi for five to ten minutes while losing only one Sharingan.
source:narutopedia
so basically madara has the rinnegan for the yin energy and he wants to create the 10 tails again so he needs hashirama's yang (life) energy with his DNA.
so Madara is like god and can create whatever he wants based upon how much chakra he has.