I think there might be just two key reasons from which other explanations to his fool facade come.
For one, the writing pov, it was an interesting plot device to remove viewers' attention from him as a relevant villain and focus on the Naruto-Sasuke overarching drama. His attitude also lightened up the atmosphere when sometimes it could get too dark (it is still a manga for shonen) and return hope to viewers that the good side will win (since the bad guys seemed to have an irredeemable idiot on their side). Further, when Tobi started showing his true colours (albeit in a slow tempo), the contrast between his joker-like attitude and his mysterious grand powers would make viewers confused, maybe slightly scared of him and scared for the well being of the good guys (since there is this weird goof who starts teleporting and becoming untouchable in the most stressful of situations). These emotions are pretty important to keep interest in the manga/anime, develop the plot, offer a more complex nuance to it and so on.
Now for the second reason, from Tobi's character pov, he adopted this attitude so he would not attract attention to him, since if anyone knew there was a roaming left-dead-but-still-alive Uchiha who was hat powerful Tobi would become a straight-up target. Now he still pretended to be Madara because that name evokes much fear so any potential hunt for him would be delayed until careful plans are developed (which would give him enough time to further his own agenda). Additionally, by appearing stupid, none of the Akatsuki would pay attetion to him, hence allowing him to observe the members and adjust the managing of the group.
Hope this helps!