Clearing campaign material outside a polling station in Houston on Wednesday.CreditTamir Kalifa for The New York Times

There is no clearer sign of the changing shape of the Democratic coalition than the fact that going into the 2018 midterm elections, six of the 20 richest congressional districts were represented by Republicans but that when the new Congress is sworn in, all 20 will be represented by Democrats.

There are, to give another example, 13 well-to-do congressional districts that voted for Mitt Romney in 2012 and Hillary Clinton in 2016. All 13 have Republican congressman. On Tuesday, Democrats won 10 of those districts.

As the Democratic Party made gains in the House and Republicans did the same in the Senate, Ashley Jardina, a political scientist at Duke, succinctly described Tuesday’s outcome as an expression of our increasing division:

While the Democrats did well, the results of the election illustrate how deeply divided the nation is around issues of race and immigration. Many hoped that Democrats would have huge wins because voters would reject Trump’s appeals to white identity politics and his anti-immigrant and nativist rhetoric. Impressive turnout among Democrats suggests that many were in fact mobilized in opposition. But enough Republican voters appeared energized to prevent the sweeping Democratic victories that some were predicting.

In states like Florida and Georgia, Jardina continued,

Republican gubernatorial challengers Ron DeSantis and Brian Kemp did well despite their racially charged campaign messages. And voters in Indiana, North Dakota and Missouri elected to the Senate new Republicans who aligned themselves with Trump’s platform in their campaigns.

The Republican acquisition of iron-fisted control of the Senate crucially depended on the defeat of three incumbent Democrats who represent less affluent red states — four, if Florida is included: Claire McCaskill, Heidi Heitkamp, Joe Donnelly and Bill Nelson.

What do these four have in common? They voted against Brett Kavanaugh. This fact will become a major problem for Chuck Schumer, the Senate Minority leader, when he tries to round up votes in opposition to Trump court and administration nominees next year or perhaps even more crucially, during the presidential campaign season the following year.

Compounding Schumer’s difficulty: Joe Manchin, Democrat of West Virginia, was the one red-state Democrat who voted for Kavanaugh, and he won re-election easily.

Looking forward toward 2020, Democratic prospects of wresting control of the upper chamber are bleak. At the moment, only one Republican incumbent up for re-election in 2020, Cory Gardner of Colorado, looks vulnerable. And Gardner’s chances look better than those of Doug Jones, Democrat of Alabama, who may find himself running against former Senator Jeff Sessions, the Attorney General Trump forced to resign on Wednesday.

The 2020 Senate election is shaping up to be the moment when the organic Republican majority within the Senate falls into place. Trump won 46 percent of the popular vote in 2016 but 60 percent of states, and states like Idaho and Wyoming get just as many senators as California. Unless a whole bunch of red states suddenly turn blue, Democrats will be stuck where they are: in the minority.

The Republican structural advantage in Senate races is reflected in the votes received by each party in Senate contests on Nov. 6. As the political website 538 reported yesterday,

Voters cast 44.7 million votes for Democratic Senate candidates and 32.9 million votes for Republican Senate candidates — in other words 57 percent of Senate votes went for Democrats.” Despite this huge gap — Democrats won 11.8 million more votes than Republicans — “there will be at least a two-seat gain for Republicans.”

This pattern outraged Marc Hetherington, a political scientist at the University of North Carolina, who emailed me:

If there is one thing the election underscores it is how malapportioned America’s representative institutions are. President Trump, of course, won the presidency while losing the popular vote by millions in 2016. Democrats in 2018 managed to eke out a 35-seat pickup while winning a national popular vote margin that is apparently going to be over 7 percentage points. A 7-point victory almost always produces a wave election type margin when translated into seats. But not this year.

Hetherington cited the House election in North Carolina:

In 2018, the GOP maintained their 9-3 majority despite the fact that the Democrats won roughly 100,000 more votes than Republicans did in these 12 contests combined.

“Democrats in red states felt good about increased turnout. They fielded good candidates in a lot of places,” Hetherington said:

And they came up exactly 0 Senate seat wins from the Great Plains to the Atlantic Ocean. Democrats need to figure out a way to win in places they haven’t been winning, and it is not clear that they got a template for that on Tuesday.

Matt Grossmann, a political scientist at Michigan State, also wrote to me along similar lines:

The Senate looks harder than ever as a long-term prospect for Democrats: without Red State senators, winning and holding the chamber will be near impossible.

Grossmann argues that the ideological positioning of candidates this year had consequences, particularly in contested districts:

The same factors were at play for the Republicans, who “also paid for extremism,” Grossmann wrote: “Kris Kobach for governor in Kansas and Scott Walker for Wisconsin governor,” but Republicans

won both of the direct gubernatorial conflicts between candidates from the far left and right: Brian Kemp vs. Stacey Abrams in Georgia and Ron DeSantis vs. Andrew Gillum in Florida.

(Abrams is not conceding defeat and still hopes to force Kemp into a runoff; she campaigned as a progressive, as did Gillum, not as someone on the “far left.”)

Brian Schaffner, a political scientist at Tufts who helps run polling for the Cooperative Congressional Election Study, told me that suburban voters leaned Democratic by more than ten percentage points but that this “pattern did not extend to the suburbs in the South” where Republican candidates “held a narrow advantage over Democrats.”

In addition, Schaffner wrote,

college-educated white women voted 2-to-1 in favor of Democratic House candidates over Republican House candidates, a margin that is larger than we’ve ever seen it. There was a lot of talk about how Trump’s abrasive rhetoric, attack on health care, and aggressive immigration enforcement might drive away this group, and it certainly has.

Mike Allen of Axios outlined how the success of both right and left in the election serves to further divide the electorate:

The Democratic strategy of targeting women, minorities and the young was vindicated with the new House majority. We saw record liberal turnout in many suburbs.

The Republican strategy of targeting men, whites and rural voters was vindicated with the larger Senate majority. We saw record conservative turnout in rural Trump country.

As for President Trump, the election put a dent in his armor both by exposing weaknesses in the Midwest and assuring sustained congressional investigations over the next two years.

The long-awaited special counsel report — now threatened by Trump’s appointment of Matthew G. Whitaker, a critic of the inquiry into Russian interference with 2016 election, as acting attorney general — may change things, but Trump remains a more than viable candidate in 2020.

The results of state legislative contests also demonstrated the failure of the election to turn into the blue wave that many Democrats were hoping for. Wendy Underhill of the National Conference of State Legislatures reported:

Democrats scored significant wins Tuesday in 2018 legislative elections — but it was hardly a blowout. Republicans continue to have a robust advantage in legislative and state control, as they have since 2010. Democrats won five legislative chambers from Republicans as well as moving the Connecticut Senate from tied to their column. That’s a shift of only six chambers, well below the average chamber switch of 12 in election cycles all the way back to 1900.

Democratic gains at the state legislative level will have little influence over redistricting, which Republicans have used to their advantage in the 23 states where they controlled the legislature and governors’ mansions.

Democratic victories in governor races, however, in Wisconsin, Kansas and Illinois will give the party crucial leverage in redrawing congressional and legislative districts after the 2020 census.

Even with everything we knew going into Election Day, Democratic discontent under the Trump administration was glaring. Exit polls conducted by CNN, ABC and other networks found that 77 percent of Democratic voters now support impeachment.

Gary Langer, who oversees polling for ABC, reported that views of Trump among all voters were not favorable:

Voters said they were casting their ballot to show opposition rather than support for Trump, by a 12-point margin, 38 to 26 percent. That left a third for whom Trump was not a factor — and they voted Republican for the House by 52-44 percent, sapping some force from the blue wave.

Nonwhites accounted for 28 percent of voters, highest ever for a midterm and 1 point from the record in any election, set in 2016. Consider the change: Nonwhites accounted for 9 percent of voters in the 1990 midterms.

Gary Jacobson, emeritus professor of political science at the University of California-San Diego, wrote in an email that the centrality of Trump in an election without his name on the ballot was clear everywhere:

The election continued a long-term trend toward more nationalized, partisan, and president-centered midterm elections. Trump’s person and behavior extended all of these trends into new territory.

As a result, Jacobson continued, “a remarkable 91 Senate seats in the 116th Congress will be held by the party that won the state in 2016.” Senate elections, in other words, have been nationalized, with the vast majority of states picking presidential and senate candidates from the same party, instead of splitting tickets between the parties.

In addition,

the level of congruence between presidential approval and the House vote (for the president’s party if approving, for the other party if disapproving) in both pre-election polls and the one postelection poll now available is the highest on record, over 90 percent.

Put all this together and what do you get?

Overall, the election exacerbated partisan divisions and ratcheted up polarization to an even greater level than before. The demographic realignment continues.

Looking toward the 2020 presidential election, the most favorable development for Democrats in Tuesday’s election was the fact that Trump has failed to convert his Midwest victories into a firm Republican base in the region.

“All the swing states, even Iowa and Ohio but especially Pennsylvania and Michigan, are back on the table,” Grossmann told me.

If Democrats can come up with a compelling presidential candidate — a candidate who can carry the Midwest — they will be as, or more, competitive than Trump and his Republicans.

In a joint report released in April, the Center for American Progress, Brookings, PRRI and the Bipartisan Policy Center accurately described the prospects and choices facing both political parties:

The scenarios in this report suggest that there are paths for both parties to win the Electoral College in 2020 and beyond. For Republicans, future success is tied to mobilizing their strength among whites without college educations — a still-substantial but shrinking portion of the electorate — while attaining gains among at least some growing demographic groups. A narrow Republican reliance on noncollege-educated whites would lead, at best, to continued popular vote losses and ever smaller Electoral College wins, which would eventually peter out.

While Democrats appear to have the advantage in future popular vote contests, their success in the Electoral College will likely require some combination of intensifying their support among voters of color and improving their margins among white, particularly white noncollege-educated, voters. This delicate balancing act will provide a challenge for the party that cannot be met by simply waiting for demographic change to reshape the electorate.

Put another way, even as this balancing act preoccupies the Republican and Democratic parties, race and immigration will retain their salience at the hot core of American politics. And Trump is certain to continue his vicious exploitation of both.

An earlier version of this column misstated how Claire McCaskill, Heidi Heitkamp, Joe Donnelly and Bill Nelson voted on Brett Kavanaugh's confirmation. They voted against him, not for him.

Thomas B. Edsall has been a contributor to The Times Opinion section since 2011. His column on strategic and demographic trends in American politics appears every Thursday. He previously covered politics for The Washington Post. @edsall