The recent upswing is real. While economic growth has been modest, the expansion is now in its eighth year. The economy has added millions of jobs and incomes increased last year for households on every rung of the economic ladder. The economic gains have been particularly strong for people who live in the nation’s large metropolitan areas and for those who have college degrees.

Yet the repeated assertions by Mr. Trump, the Republican nominee, that the middle class is being decimated and the economy is in decline ring true to his supporters. Many Americans, even those who are prospering, remain pessimistic about the fragile recovery. Hillary Clinton, his Democratic rival, has been careful to acknowledge the economy’s problems alongside its progress.

The economic dislocations of recent decades may be contributing to the polarization of the electorate, according to research by David Autor, an economist at the Massachusetts Institute of Technology. By emphasizing the nation’s economic troubles, the candidates are going where the voters are.

In a new paper, Mr. Autor and three co-authors found that voting patterns had shifted most in the parts of the country that lost the most jobs as a result of increased trade with China. The study, which focused on congressional elections, found that voters in districts with heavy job losses have tended toward ideological extremes, replacing moderates with more conservative or liberal representatives.

“There is this undercurrent of economically driven dissatisfaction that works to the benefit of candidates who are noncentrist, and particularly right-wing candidates,” Mr. Autor said.