Mace nearly beat him. Palpatine was a planner, but there's too much chance involved and too much at stake. Unless Palpatine can see the future entirely, then he's nigh-unbeatable...except for some reason during the second Death Star battle. Over-confidence was Palpatine's weakness, wasn't it? That's why get got disfigured and why he wound-up getting the shaft.
As originally filmed, Anakin was to be there the whole time, with Palpatine using Anakin's lightsaber.
Anakin turning was almost given, killing Mace before he arrived or not. Palpatine knew that when Anakin doesn't attack after Palps reveals he was a sith and Anakin buys that "i can save Padme" crap.
We never saw any Jedi beat a Sith without that Jedi displaying negative emotions, angered young Obi-Wan in TPM, arrogant Anakin beating Dooku and infuriated Luke beating Vader. Perhaps embracing the dark side gives Jedi the edge to beat a Sith. Did Qui-Gonn sacrifice himself so that Kenobi would have the anger to beat Maul?
Had Mace won and killed Palpatine, there was a strong chance that Mace would've turned to the dark side.
"I AM the Senate, Mother****er!!!"
In the novelization, which lightly refs another story, Mace had been warned once that the Sith were already in control, so his rage and fury at Anakin telling him about Palpatine was if anything, even greater. Yoda would never have sent that party to confront Palpatine, IMO. He would have urged caution against one who had hidden so well for so long. He also would have had someone literally sit on Anakin. Mace should have clocked him, if he wanted him to stay put. Expecting Ani to obey orders in that instance was the stupidest thing since Angel and crew confronted Evil Cordelia w/o checking where Connor was first. Also, Mace had discussed the Council taking the reins of power before even knowing who Palpatine was.
My take on the last fight is : If Palps was never taking any risk, then much of his planning and patience was unneeded. He was a huge risk-taker, albeit after knowing the gaming field intimately and tweaking it not a little. Who's to say how much he really did? Even if neither he nor Plageus had anything to do with Ani's birth, could he have caused Shmi and her son to be so indebted as to be enslaved, thus ensuring a bitter chosen one?
But what gave victory to Palpatine in the PT wrecked him in the OT. He seemed to lose sight of the fact that, in the PT, he ran both sides of the chessboard, and had been an intimate part of his embittered target's life perhaps from the very start. But he knew nothing of Luke at least for a long while, even if later EU novels retcon it to earlier than ANH (They haven't that I know of). Luke was anxious to move on, but he was never a slave. And I would call Luke a moaner rather than a whiner. To me, a moaner is impatient, but not thoughtless of others. Robot Chicken SW2 aside, I'm pretty sure he realized that Leia had lost her homeworld while he mourned Ben. A whiner like Anakin is much more me-oriented. Luke never saw himself as the be-all of the Rebellion, far from it, and no one save Leia ever told him he was indispensible, or words to that effect.
Finally, while Palps plan over Endor was brilliant, he didn't secretly run the Rebellion as well, and Luke had grown up fearful of or despising him, not looking to him as Ani did.
Palps rolled the dice twice, winning big the first time, albeit with magnets and levers around the table, and getting snake-eyes the second, then being bounced from the club.