Halfway through the biggest election year in history, the results are in. The verdict: Expect the unexpected and don’t underestimate that voters are people with bills to pay.

Elections over the past week involved countries with around 1.1 billion registered voters, about half the number expected to go to the polls worldwide this year. From Mexico to India and South Africa, voters delivered verdicts that ran counter to predictions, rattling financial markets as they turned expected landslides into narrow wins—and vice versa—by giving priority to their own economic prospects in a new era of high interest rates and stubborn inflation .

The results might offer a foretaste of momentous upcoming polls in the U.S. and Europe, or could simply serve as a reminder that predictions about election outcomes are just that—predictions.

Running through all the past week’s ballots was a chorus of voter discontent with inflation, unemployment and corruption. The parties that set out to address their concerns outperformed. Politicians who were slower off the mark, or who attempted to appeal to identity politics, stumbled.

Markets, too, were caught off guard.

In India, stocks surged to a record high on Monday after exit polls pointed to a strong win for Prime Minister Narendra Modi ’s party. But when the votes were counted Tuesday stripping him of a majority, India’s benchmark stock index fell nearly 6% , the most since May 2020. The rupee weakened against the dollar.

South Africa’s African National Congress fared worse than polls predicted, with voters denying it an outright majority for the first time in postapartheid history, unnerving investors who are now waiting to see what form a coalition government might take. Stocks fell nearly 2% as early results came in on May 30. The rand declined against the dollar and has continued to depreciate this week.

In Mexico, conversely, expectations were upended by the scale of Claudia Sheinbaum ’s victory. Nearly everyone expected her to win. But the popularity of her ally, the departing incumbent President Andrés Manuel López Obrador and his free-spending policies provided her an unexpected lift. Her Morena party now has a freer hand to pursue a more aggressive agenda in the legislature, prompting the Mexican peso to fall more than 4% against the dollar to its weakest level in about seven months. The country’s benchmark IPC stock market declined 6% , the biggest drop since the onset of the Covid-19 pandemic.

The results serve as a lesson that is often forgotten in the fever produced by elections: Politics is unpredictable, opinion and exit polls can deceive and ballots spring surprises. And, more importantly for those campaigning in the big elections still to come, in the U.S., Britain and elsewhere, how voters feel about their finances still matters.

“It’s a wake-up call to political parties, potential governments, and existing governments everywhere,” said Simon Quijano-Evans, chief economist at Gemcorp Capital Management.

Sheinbaum greeted her supporters in Mexico City after winning the election. June 3, 2024. REUTERS/Alexandre Meneghini

In Mexico, López Obrador built his popularity by helping people to weather years of pandemic-induced pain. Policies such as doubling the minimum wage over the past six years and handing out cash to everyone from the elderly to students helped many people cope with the whiplash of inflation that has buffeted much of the world in recent years, benefiting Sheinbaum, his chosen successor.

“She will carry on many of the proposals of López Obrador,” said Paula Miranda, 33, a dentist based in Mexico City, who voted for Sheinbaum. “At the end of the day, she is from his same school of thought, so it’s logical that all this will continue.”

A woman casts her ballot at a polling station during general elections, in Zinacantan, Mexico June 2, 2024. REUTERS/Gabriela Sanabria

Polls had predicted the ANC’s failure to hold on to its customary majority in South Africa, but the fall in its vote confounded even the closest poll watchers. The result is widely seen as a strong rebuke for years of corruption scandals and an inability to deliver jobs, housing and security for large parts of the electorate.

“We want to work,” said Angela Msinda, a 20-year-old looking for a job in Bronkhorstspruit, near South Africa’s capital of Pretoria. Her vote went to uMkhonto weSizwe, or MK, a party founded in December and led by scandal-ridden former President Jacob Zuma , which garnered 15% of the vote and campaigned on a promise to create five million jobs in the next five years.

The biggest shock came in the largest and longest election. Indian voters scrambled Modi’s plans to begin a third term as leader with a thumping majority, hampering his ability to force through an economic program to loosen labor laws and constrain welfare programs. Modi’s Bharatiya Janata Party has given all households free grain since the pandemic, but the opposition offered to double wages under a welfare program that provides a guaranteed number of days of work in villages and pledged to write off student loans.

Modi’s attempts to energize his Hindu nationalist base with divisive religious rhetoric, and moves against opposition figures, backfired. Ahead of the election, opposition figures and parties faced tax and corruption inquiries. One popular opposition politician spent most of the six-week election in jail, released for a few weeks to campaign. Opposition party workers said they heard from voters that they wanted change because the government had become too “arrogant.”

Exit polls had pointed to a Modi landslide, but the outcome left him at the mercy of other parties needed to form a coalition.

Voters said their incomes hadn’t increased during Modi’s decade in power, while inflation had crimped their spending power. The opposition successfully capitalized on the sense that India’s economy is moving on two tracks and inequality is deepening.

“We had all wanted change and we voted for change,” said Ramesh Kumar, the elected head of Matour village in the northern state of Haryana. Previously a member of the BJP, he joined an opposition party just a month before the election.

India’s election provided a particular warning about the unreliability of polling, which as during the Brexit referendum and 2016 U.S. election, was no guide to the eventual result.

“In these elections, there was clearly some degree of not wanting to reveal who you voted for, perhaps given social pressures. In a pro-Modi India, voters didn’t want to reveal they were maybe not so pro-Modi,” said Shaniel Ramjee, a multiasset fund manager at Pictet Asset Management. “We’ve seen this previously in the U.S. and this could happen again, given the controversy around former President Trump,” he said.

The race between Donald Trump and President Biden, while taking place against a backdrop of voter concern about issues such as abortion rights and immigration, is also heavily influenced by the economy .

Americans trust Trump over Biden on inflation and the economy by a margin of 14 percentage points, according to a recent ABC News/Ipsos poll 

Before that vote, other bellwether elections are quickly approaching.

Up to 370 million voters are taking part in European Union polls this week, in which right-wing parties are expected to make gains . The nationalist agenda faces significant hurdles in Europe because the bloc is a grouping of 27 sovereign states, not one federal state like the U.S. To reach decisions on most big issues, governments must compromise. Adding complexity, leaders win a seat at the EU table through their national elections—not EU-wide elections—and domestic political pressures make it hard to forge a pan-EU agenda.

In U.K. polls on July 4, the Conservative Party, which has ruled for the past 14 years, is predicted to lose by a huge margin, punished by voters for living costs propelled higher, like elsewhere in Europe, by the pandemic and the Ukraine war, but exacerbated by the country’s decision to leave the EU.

Other countries that have held polls this year include Indonesia, Russia , Taiwan and Pakistan.

Taiwan’s new president, Lai Ching-te, took office last month after winning 40% of the vote , defeating two opposition candidates who had campaigned on closer ties with China. Nonetheless, his party lost its legislative majority in January’s elections, in part reflecting disillusionment on issues such as inflation, low wages and high home prices.

In Pakistan, voters defied the country’s powerful military , to elect candidates associated with jailed opposition leader Imran Khan as the single biggest bloc in parliament but short of a majority. Khan’s supporters blamed vote rigging, which was denied by authorities. The other parties combined to form a new government under Prime Minister Shehbaz Sharif .

Khan’s ousting as prime minister in 2022, his subsequent imprisonment and a crackdown on his party created a wave of sympathy, political experts say. After his ejection from office, inflation hit 40%.

Write to Joanna Sugden at joanna.sugden@wsj.com and Anna Hirtenstein at anna.hirtenstein@wsj.com

Corrections & Amplifications undefined Claudia Sheinbaum’s party is called Morena. An earlier version of this article incorrectly said the party was called Moreno. (Corrected on June 7)