BERLIN — Only a few weeks ago, the political career of Israeli Prime Minister Benjamin Netanyahu appeared set to end, amid scandals and looming indictments.

But after Tuesday’s elections, the incumbent will probably be able to form a new government once again, seizing a fifth term as prime minister. If things go according to his plan, Netanyahu will become Israel’s longest-serving prime minister this summer.

At international summits, the global divide between prime ministers who never leave and leaders who come and go are especially apparent. When German Chancellor Angela Merkel — in power since 2005 — met the new (and perhaps soon to be former) prime minister of Australia, Scott Morrison, last fall, she was caught secretly checking a cheat-sheet on her colleague, seconds before going into her meeting with him. Many Australians took the incident with humor: After all, Australia has had five prime ministers within the last five years. It’s hard to keep track sometimes.

But why do politicians like Netanyahu keep getting reelected, whereas others fail almost immediately?

There certainly isn’t any globally applicable “reelection” recipe — if there was one we would see a lot more Merkels and Netanyahus in the world. In fact, many of the longest-serving democratically elected prime ministers and presidents couldn’t be more different from one another.

Just compare Merkel’s careful, or even boring, public rhetoric with Netanyahu’s Trump-style use of Twitter or his infamous “red line” graphic, which warned the world of a nuclear Iran at the U.N. General Assembly in 2012.

Merkel has also mastered the skill of changing her opinion whenever the public mood shifts without causing too much of a stir, whereas Netanyahu has rallied his supporters around a largely unchanged set of core promises.

Meanwhile, Merkel is liked by many liberal voters who would still never cast their ballot for her conservative party, whereas Netanyahu himself is deeply unpopular among opposition circles.

Still, in both countries and other places with democratic parliamentary systems where leaders have managed to stay in power, there are some similarities.

The economy (but, surprisingly, not necessarily economic growth)

Ahead of the 2020 presidential election in the United States, a lot of emphasis has been put on unemployment numbers and economic growth. But evidence from prior reelection campaigns around the world suggests another figure is more important: inflation, which determines whether prices rise or fall.

“Higher growth rates over the term raise reelection probabilities only in developing countries and new democracies,” wrote Adi Brender and Allan Drazen in a 2008 study, published in the American Economic Review.

“Low inflation is rewarded by voters only in developed countries,” they added. That category would include not only the United States, but also Germany and Israel.

The evidence that emerged out of Israel and Germany in the years since Brender and Drazen’s study was published appears to have proved them right. An initially unpopular Merkel was able to secure reelection at the height of the financial crisis in 2009 — curiously during a year in which inflation fell to a record low in Germany and prices dropped. Inflation rates have remained low since. Likewise, inflation rates have also been low during Netanyahu’s terms — which, in both leaders’ cases, might be the outcome of a mix of lucky timing and deliberate economic policies.

A perception of being indispensable

In their very own ways, leaders who cling to power have successfully created a perception that they are indispensable to their countries. Pointing at a track record of what they portray as success, those leaders manage to offer a sense of stability.

In Merkel’s case, stability has often been associated with the economy, even though her critics have maintained that more than a decade of prosperity has largely been the success of reforms pursued by the previous social democratic government. After more than 13 years as chancellor, however, an entire generation of young Germans has grown up that can’t even remember a time before Merkel was voted into office.

In Netanyahu’s case, the stability he says he’s offering is mostly associated with national security. His friendly ties with President Trump have made many voters believe that only he might be able to maintain the alliances needed to protect Israel.

A grip on their own party

Let’s go back to the example of Australia for a moment. Whereas Merkel and Netanyahu had to fear being toppled by voters during elections, Australian leaders would be well advised to be more afraid of their own parties. Since 2007, not a single Australian prime minister has finished his or her term.

But that doesn’t necessarily mean that Australia’s last five prime ministers were just not up to the task.

Instead, it’s a reflection of Australian politics, where it can take as little as a simple majority of a ruling party’s MPs to remove their own prime minister. The ruling party’s subsequent new leader then usually becomes the new prime minister.

In Germany, the same situation would almost inevitably result in new general elections, which gives chancellors far more leeway to crack down on dissent within their own party.

The importance of exactly that type of control became obvious in 2017, when Merkel appeared to lose her grip on her party amid the emergence of a far-right competitor filling the void created by her pro-refugee policies and her general shift toward more liberal positions.

What followed was Merkel’s worst election result since becoming chancellor and months of painful coalition negotiations, followed by her announcement that her fourth term would be her last.

More on WorldViews:

Netanyahu clings on: Key takeaways from Israel’s election

Why this viral photo is becoming a symbol of women’s rights protests in Sudan

What Trump did to push the Israeli election in Netanyahu’s favor — and what he didn’t do