On Thursday, Britons will vote on whether to leave the European Union, an option supported by Nigel Farage, the leader of the U.K. Independence Party. Photograph by Chris Ratcliffe / Bloomberg via Getty

If things go as expected on Thursday, British voters will reject the option of leaving the European Union. Likewise, if things go as expected come November, American voters will reject the option of electing a President Trump. Both outcomes would be reassuring, but they wouldn't mean the end of right-wing populism on either side of the Atlantic—they may merely represent new high-water marks.

When the Brexit referendum is done, tens of millions of Britons will likely have registered a vote against the liberal vision of European unity and assimilation. In this country, even after the disastrous past few weeks Donald Trump has had, a new opinion poll, from Quinnipiac University, indicates that in crucial states like Ohio and Pennsylvania he remains statistically tied with Hillary Clinton.

Why is this happening? Trump and his counterpart in Britain, the U.K. Independence Party (UKIP) leader Nigel Farage, didn't emerge from nowhere. Both are wealthy men who affect an affinity with the common people, and who have skillfully exploited a deep well of resentment among working-class and middle-class voters, some of whom have traditionally supported left-of-center parties. Certainly, a parallel factor in both men’s rise is racism, or, more specifically, nativism. Trump has presented a nightmarish vision of America overrun by Mexican felons and Muslim terrorists. UKIP printed up campaign posters that showed thousands of dark-colored refugees lining up to enter Slovenia, which is part of the E.U., next to the words "BREAKING POINT: The EU has failed us all." But racism and nationalism have both been around for a long time, as have demagogues who try to exploit them. In healthy democracies, these troublemakers are confined to the fringes.

Historically, transforming radical parties of the right (or left) into mass movements has required some sort of disaster, such as a major war or an economic depression. Europe in the early twentieth century witnessed both, with cataclysmic results. After the First World War, the introduction of social democracy, the socioeconomic system that most Western countries settled on, delivered steadily rising living standards, which helped to keep the extremists at bay. If prosperity wasn't shared equally—and it wasn't—egalitarian social norms and redistributive tax systems blunted some of the inequities that go along with free-market capitalism.

But in the past few decades Western countries have been subjected to a triad of forces that, while not as visible or dramatic as wars and depressions, have proved equally destabilizing: globalization, technical progress, and a political philosophy that embraces both. In the United States, it is no coincidence that Trump is doing well in the Rust Belt and other deindustrialized areas. A one-two punch of automation and offshoring has battered these regions, leaving many of their residents ill-equipped to prosper in today's economy. Trump is exploiting the same economic anxieties and resentments that helped Bernie Sanders, another critic of globalization and free trade, carry the Michigan Democratic primary.

"There is no excuse for supporting a racist, sexist, xenophobic buffoon like Donald Trump," Dean Baker, an economist and blogger at the liberal Center for Economic and Policy Research, in Washington, noted recently. "But we should be clear; the workers who turn to him do have real grievances. The system has been rigged against them."

Similarly, it is not an accident that UKIP is popular in the former mill towns of northern England, in the engineering belt of the West Midlands, and in working-class exurbs of London. "Children emerging from the primary school next door, almost all from ethnic minorities, are just a visible reminder for anyone seeking easy answers to genuine grievance," the Guardian's Polly Toynbee wrote, last week, after a visit to Barking, in Essex, which is close to a big car factory owned by Ford. "As high-status Ford jobs are swapped for low-paid warehouse work, indignation is diverted daily against migrants by the Mail, Sun, Sunday Times and the rest. . . . This is the sound of Britain breaking."

For the past half century, the major political parties, on both sides of the Atlantic, have promulgated the idea that free trade and globalization are the keys to prosperity. If you pressed the mainstream economists who advise these parties, they might concede that trade creates losers as well as winners, and that the argument for ever more global integration implicitly assumes that the winners will compensate the losers. But the fact that such a sharing of the gains has been sorely lacking was regarded as a relatively minor detail, and certainly not as a justification for calling a halt to the entire process.

If you are reading this post, the likelihood is that you, like me, are one of the winners. Highly educated, professional people tend to work in sectors of the economy that have benefitted from the changes in the international division of labor (e.g., finance, consulting, media, tech) or have been largely spared the rigors of global competition (e.g., law, medicine, academia). From a secure perch on the economic ladder, it is easy to celebrate the gains that technology and globalization have brought, such as a cornucopia of cheap goods in rich countries and rising prosperity in poor ones. It's also tempting to dismiss the arguments of people who ignore the benefits of this process, or who can't see that it is irreversible.

But, as Baker points out, "it is a bit hypocritical of those who have benefited" from this economic transformation to be “mocking the poor judgment of its victims”—especially now that the forces of global competition and technological progress are reaching into areas that were previously protected. In a world of self-driving cars and trucks, what is the future for truck drivers, cab and limo drivers, and delivery men? Not a very prosperous one, surely. And the creative destruction that the Austrian economist Joseph Schumpeter celebrated won't stop there. With software that can transfer money at zero cost, medical robots that can carry out the most delicate of operations, and smart algorithms that can diagnose diseases or dispense legal advice, what is the future for bankers, surgeons, doctors, lawyers, and other professionals?

There is no straightforward answer to this question, just as there is no easy answer to the question of what can be done to help those who have already lost out. One option is to strengthen the social safety net and, perhaps, to move toward some sort of universal basic income, which would guarantee a minimum standard of living to everybody, regardless of employment prospects. The political enactment of such solutions, however, is contingent on the existence of social solidarity, which the very process of economic and technological change, by heightening inequalities and eroding communal institutions, undermines.

Lacking grounds for optimism, and feeling remote from the levers of power, the disappointed nurse their grievances—until along come politicians who tell them that they are right to be angry, that their resentments are justified, and that they should be mad not just at the winners but at immigrants, too. Trump and Farage are the latest and most successful of these political opportunists. Sadly, they are unlikely to be the last.