Republicans will maintain control of the Senate for at least two more years, after Democratic losses in Indiana, Tennessee, Texas and North Dakota — states that President Trump won by double digits in 2016. Trump campaigned aggressively in those states.

Senate GOP leaders capitalized on a battleground map that left Democrats defending 26 seats, including ten in states President Trump won in 2016. Now they must defend President Trump's hard-line rhetoric and policy on issues like immigration and trade, despite tensions within the party over those same issues.

Trump was not on the ballot this year but he has been an unmistakable force in congressional contests and statewide elections across the country.

Early vote data released early Tuesday indicated that the electorate was shaping up to be younger and more diverse from the last midterm election. Turnout levels were already significantly higher across several demographic groups, and up in states with competitive Senate contests — Arizona, Texas and Nevada.

The president's impact played out differently in the roughly 80 competitive House races and more than a dozen close Senate contests.

Senate races in mostly red states benefited from Trump focus

Senate Democrats faced a steep challenge as they fought to keep seats in states Trump won by double-digit margins in the worst battlefield for any party in modern history.

Just six Republicans were up for re-election, all but one of them ran in safely Republican states.

They landed on a plan to allow each vulnerable Democrat to run an independent campaign without a unified platform. For example, Heidi Heitkamp in North Dakota could stump on protecting farmers while Joe Manchin in West Virginia promised new health protections for coal miners.

But Republicans had the advantage of simply reminding their base of all of the times Democrats voted against Trump. Heitkamp reached out to Trump White House officials and attempted to craft a bipartisan posture, but she voted against Brett Kavanaugh's nomination to the Supreme Court. And other red state Senate Democrats running for re-election — Claire McCaskill in Missouri and Joe Donnelly in Indiana — did the same.

Trump personally played a significant role in tight Senate contests in the closing weeks of the election cycle. He traveled to Indiana, Florida, Montana, Nevada, Missouri and Mississippi — and in some cases landed in dramatic fashion aboard Air Force One to crowds of supporters enthusiastically cheering his red-meat speeches focused mostly on immigration and warnings about what Democratic control meant for his agenda.

His visits included overt reminders to his base supporters that they weren't just voting for any Republican on the ballot — they were voting for senators promising to back his priorities.

"They want to raise your taxes, the Democrats do, restore crippling regulations, shut down your new steel mills, take away your health care, and put illegal aliens before American citizens," Trump said in a closing rally in Indiana on Monday. "If you want more caravans, if you want more crime, vote Democrat tomorrow."

House battlefield hinges on contests in suburban and exurban districts

Democrats pinned their hopes for retaking the House on boosting turnout among women and minorities and wooing moderate suburban voters who were turned off by Trump.

They focused on recruiting diverse candidates that might have once seemed outside the box for the party. That included gun owners and military veterans — and a lot of female candidates. The strategy was well tailored to turn out voters for House seats.

It means Democrats will have to bridge the demands of a party that has grown to embrace progressives, like Alexandria Ocasio-Cortez, who is expected to win in a safely Democratic district in New York, while electing moderates like Conor Lamb in Pennsylvania, who won a special election earlier this year and is favored to win Tuesday in a reconfigured district.

A Democratic caucus that's expected to expand will test the power and influence of leaders like Nancy Pelosi, D-Calif., who plans to seek another term as speaker of the House.

Pelosi has been criticized by a vocal group inside the caucus as being out of touch with her changing party and unwilling to provide opportunities to newer members. She was the subject of millions of dollars in Republican attack ads this cycle, forcing more than a dozen candidates to publicly vow not to support her for speaker.

That divide could make it difficult for House Democrats to unify around an agenda. Pelosi has vowed to pass campaign finance reform regulations and launch investigations into the Trump administration immediately. But there will be pressure from her most progressive flank to vote on proposals like a "Medicare-for-all" health care plan.

Instead, Pelosi has promised to focus first on government and campaign finance reform measures.

"When we win, on the opening day, our Democratic congress will be open and transparent," Pelosi said at an event Tuesday morning.

Republicans will have to battle an opposite trend. Many moderate members chose to retire rather than face tough re-election campaigns. With the bulk of the competitive races focused in suburban districts, GOP candidates and leadership aides worried the president's tough rhetoric about immigration may have turned off women and independents in those areas.

House Speaker Paul Ryan appealed to the president the weekend before the election to focus on the strong economy and benefits from the 2017 tax cut. While Trump did boast about these accomplishments, he continued to emphasize his push to crack down on the "caravan" — the group of Central American migrants heading toward the Mexican border with the United States. He also declared he would end birthright citizenship with an executive order — a proposal Ryan said would be unconstitutional.

House GOP leaders are expecting to oversee a more conservative conference next year, with some losses expected in seats held by centrists. That tilt to the right will likely mean even more pressure by top leaders for members to stick together to vote on legislation that is closely aligned to Trump and his agenda.

A year of big money and big controversy

Democrats benefited from a flood of donations to official party organizations and outside groups working on their side. Democratic candidates and their outside supporters are expected to spend more than $2.5 billion on this year's election, according to the Center For Responsive Politics. Republican candidates and their backers are on track to spend $2.2 billion.

Fundraising in 2018 far outpaced what is normal for a miderm election.

Both parties saw dramatic surges in donations that were closely correlated with national political events like the hearings on sexual assault allegations during the confirmation of Supreme Court Justice Brett Kavanaugh. Donors responded to heated political battles, like funding a wall on the border with Mexico and Republicans' failed attempts to repeal the Affordable Care Act, by flooding candidates with cash.

Copyright 2018 NPR. To see more, visit http://www.npr.org/.