The president’s deportation policies, along with high prices and changes in who turned out to vote propelled a shift in this year’s election.