There are many tactics how to stay in power, once you have assumed a prominent political position. Back in the days pretty brute tactics and violent means were used by autocrats to assume power and remain in that position. Today, there are more subtle methods to remain top dog. President Vladimir Putin of Russia and President Recep Tayyip Erdogan of Turkey have managed rather similar approaches.
The basic method of staying in power is simple: You switch top positions from head of government (prime minister) to become head of state (president), and back if need be. Putin, having first assumed the premiership in 1999 seems somewhat more versatile, having switched positions more often than Erdogan. In a second step, the power of the most recent position can be enhanced.
In Russia, former president Dmitry Medvedev extended the presidency from 4 to 6 years for whoever would become president after him, in this case Putin. Erdogan took one turn more but was equally effective: He assumed the Turkish presidency (after three terms as prime minister) by popular vote in 2014 and then had a referendum in 2017, turning the erstwhile ceremonial position into a powerful executive post.
It's all about retaining some political legitimacy by not breaking the rules altogether (like having a coup and installing a dictatorship) but playing the system by bending the rules to a maximum to stay in power. While the era of infamous dictators in military fatigues is all but over, the slightly more subtle era of suit-and-tie strongmen is alive and kicking.