Well, to put it right, Madara was hoping as well as planning to resurrect in Nagato's body with Rinne Tensei, but failed.
He wanted to become Juubi's Jinchuuriki after reusrrection but Obito snatched his chance. But he planned to take control of Obito once Obito gets weakened by the SA (when Hashirama wasn't resurrected)
Soon Hashirama resurrected and Madara waited for the right moment to get resurrected in Obito's body by using Hashirama's Sage mode to beat Obito. How? By controlling SM Hashirama with the black rods and making him fight Obito till end. Hashirama is resurrected in a Zetsu Clone, the clone which is formed out from the flower and through which Madara created those Black Rods.