The American political establishment reeled on Wednesday as leaders in both parties began coming to grips with four years of President Donald J. Trump in the White House, a once-unimaginable scenario that has now plunged the United States and its allies and adversaries into a period of deep uncertainty about the policies and impact of his administration.

Democrats, who will be out of power in both the White House and Congress for the first time since 2006, were particularly crestfallen that Hillary Clinton had a slender lead in the popular vote but lost in the Electoral College, a fate similar to Al Gore’s in 2000.

On campuses nationwide, students marched against Mr. Trump with signs bearing slogans like “Not my president,” and protesters in Oakland, Calif., smashed windows and set fire to garbage bins. On Wednesday night, thousands of people protested in several cities, including Chicago, Philadelphia, Seattle and New York, where demonstrators converged in Midtown Manhattan in front of Trump Tower, the home of the president-elect.