Well, I'm talking about the Senpo: Inton Raiha and the Senpo: Ranton Kouga. To perform these two jutsus, one must have the Sage of the Six Paths senjutsu. These are not common jutsus and I don't believe Madara has ever saw someone using them.
At first I would like to quote this from wiki:
Intelligence of Madara Uchiha
Madara's years of experience on the battlefield honed his strategic ingenuity. He could quickly devise a number of approaches and could switch approaches immediately. He could form and verify any theories he comes up with using small details. In addition to his sheer adaptability, Madara was knowledgeable on a large variety of individuals and abilities, and thus could identify techniques when used and react with the most appropriate counter to them.
Means he was knowledgeable and he was having so much of knowledge that he can perform various types of technique by simply observing them. There is no doubt that he was one of the kind with such a great observation skills.
There also one point which is worth noticing that :
Madara do not use certain techniques more than once
Also you may think that performing those technique it take more than 1 year of practice before it can be use in real fight. But Madara has large chakra reserves which allowed him to fight nonstop for twenty-four hours before collapsing. He was skilled in chakra control as he could perform complicated techniques with a single hand seal. This is partly because he inherited Indra's chakra.
This point is also worth noticing which explains a little about how he can perform various technique :
He is able to identify people and their powers by sensing their chakra and masters the mightiest fire-based attacks in existence: overwhelming streams of fire, gigantic clouds of searing ashes, and powerful fireballs shaped like dragon heads, just to name a few
There are few more possible explanation which proves that Madara has some real observation skills :
When Madara awakened his Sharingan as a child, with one tomoe in both eyes. With brief eye contact, Madara could place targets under genjutsu and paralyse them or relay information.
So while fighting he used to gather enough information about the technique which his opponent uses. You must also note that Madara was in so many fights so just think how much experience he is having.
Madara and his brother Izuna were the first Uchiha to awaken the Mangekyō Sharingan. Madara knew about other users Mangekyō techniques, and was also capable of discerning the mechanics of these techniques with brief observation.
So he was able to learn all those techniques with brief observation.
Madara Uchiha noted that the Sharingan can only be used to its full potential when both eyes are together.
This proves that he observe everything carefully.
After noticing all these points there is no doubt that Madara got some serious observation skills and also he always try to use new techniques every time. It might be true that he may have never known about few Jutsu and also he have never used it or seen it anywhere but he may have observed it and may have learned about that new Jutsu before he have tried it.
Remember back in early days of naruto when Kakashi was the "copy cat" ninja just because he had sharingan, and it was stated that the sharingan allowed a ninja to view another person's jutsu and copy it? Remember when Madara was reanimated with senju sage blood and could do hashirama's jutsu, despite not having the ability to ever do it before? I think generally madara could do any jutsu that he'd seen before, provided the conditions were met (proper amount of jutsu, proper control of natures, etc.), or at least that's my guess ;).
Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.