John Barry describes how dictators maintain power:

[T]he real key to regime survival has been what RAND Corporation analyst James Quinlivan calls “coup-proofing.” In an influential 1999 study, Quinlivan itemized the basic safeguards for dictatorships. First: Consolidate an inner core bound to the regime by “family, ethnic, and religious loyalties”in essence, a mafia, with goodfellas in various guises protecting the big guy’s back (and their own; if he goes down, so do they).

Second: Create a parallel military devoted to regime protection, like Iran’s Revolutionary Guard Corps, which does the supreme leader’s bidding while the remnants of the shah’s army stand by. Third: Maintain multiple secret police, security, and espionage services that spend much of their time keeping each other in check.

And the regular army still has to be bought off. ... Coup-proofing isn’t cheap. The region’s big oil producers can usually afford it, especially when crude prices are as high as they are now. Regimes without substantial oil reserves tend to rely on foreign patrons.