The answers to this (What is the most number of times someone has become leader of a European country?) question should show which Europeans were heads of state and/or heads of government of their countries the most times.
You have to be careful to see which of them were elected to office consecutively and which were elected or usurped the throne non consecutively. The examples include someone who was Grand vizer of the Ottoman Empire eight times with seven gaps between periods of rule, and someone who was Prime Minister of France eleven times, with five gaps between periods of rule. Rurik I or II Rostislavich, was grand prince of Kiev five, six, or seven times, with four, five, or six gaps between his reigns.
And those answers only apply to European countries.
According to an answer to Which monarch had the longest break in their reign Norodom Sihanouk's two terms as King of Cambodia were separated by 37 years. But he also had the position of head of state of Cambodia two times during that interval, so if you count being king and being head of state together, there were 3 gaps between his reigns.
But I remember researching and writing something about Norodom Sihanouk fairly recently. As I remember Norodom Sihanouk also had about ten terms as prime minister of Cambodia. If you count king, head of state, and prime minister together, there will have been several more gaps between the various reigns of Norodom Sihanouk.
In Africa, Tekle Giyorgis I (c. 1751-1817) was king of kings of Ethiopia six times between 1779 and 1800, thus having five gaps between his reigns.
In the USA, Grover Cleveland had one gap between his two administrations as president in 1885-89 and 1893-97.
You could joke that Mexican dictator Antonio Lopez de Santa Anna (1794-1876) was in and out of power so often they had to put a revolving door on the presidential palace. There were ten gaps between his eleven terms as president.
And those are the best examples I can think of.