The campaigns of Donald Trump and Bernie Sanders have tapped into a deep well of anger and anxiety about international trade. While their ideas for changing American trade policy are unrealistic — and, in Mr. Trump’s case, nonsensical — their campaigns are doing something important by calling attention to the government’s failure to help workers who have been hurt by globalization.

This much is clear: While trade with other countries benefits the economy over all, it creates winners and losers. In recent decades, the winners have included consumers who are able to buy cheaper clothes, electronics and other imported goods, and companies like Boeing and General Electric that have been able to sell more of their products overseas.

The losers have primarily been businesses and workers who face greater competition from foreign factories that can produce similar goods at lower prices. Economists and political leaders have long argued that if the winners compensate the losers, everybody should be better off. But in practice, American policy has allowed the winners to keep most of the spoils of trade and has given the losers crumbs. This has exacerbated income inequality by raising the profits of big corporations and the salaries of executives and other white-collar professionals while leaving blue-collar and lower-skilled workers poorer, as Mr. Sanders has correctly pointed out.

Recent economic research shows that workers who live near manufacturing hubs in Midwestern states like Ohio and Michigan have suffered high unemployment and low wages because of the transfer of manufacturing in the last 20 years, principally to producers in China. The worst of that shift has probably passed, but its aftereffects are still being felt across the country. One recent paper by three economists, David Autor, David Dorn and Gordon Hanson, concluded that in places affected by Chinese imports unemployment rates remain “elevated for at least a full decade after the China trade shock commences.” The workers who lost their jobs were not able to find new jobs easily, and when they did find work it did not pay as much as they had previously earned.