(CNN) Republican Sen. Cindy Hyde-Smith was expected to coast to victory in a Mississippi runoff that would conclude the last Senate race of 2018's midterm elections.

Instead, Hyde-Smith has spent the days leading up to Tuesday's election mired in controversy that evoked the state's dark history of racism and slavery.

It began when video emerged online of her telling supporters earlier this month that she'd be "on the front row" if one of her supporters there "invited me to a public hanging." She later called the comments an "exaggerated expression of regard," but her use of the phrase "public hanging" brought memories of Mississippi's history of lynchings to the forefront and put the contest under the national microscope.

On Tuesday, Mississippi voters will decide between Hyde-Smith and Democrat Mike Espy, who, if elected, would be the state's first black senator since Reconstruction. President Donald Trump, anxious to finish out the 2018 campaign season with a Republican victory, urged voters to turn out for Hyde-Smith in a tweet Tuesday.

The result will finalize the balance of power in the US Senate. As it stands, Republicans will hold 52 seats next year, and Democrats will have 47. A win for the GOP in Mississippi would further pad the party's majority in the Senate, even as Democrats have taken a solid majority in the House.

The state is polarized along racial lines, with most white voters backing Republicans and nearly all black voters supporting Democrats.

Democrats hope Hyde-Smith's comments will lead to a surge in black turnout and propel them to victory. However, even if black voters, who make up nearly 40% of the state's electorate, come out in full force, Espy would still have to outperform his party's history with whites to have a chance of winning.

And Democrats have to overcome partisan trends in the deeply red state. Earlier this month, when multiple candidates in both parties were on the ballot, Hyde-Smith and conservative Chris McDaniel combined for 58% of the vote, while Espy and Democrat Tobey Bartee got 42%.

On the eve of the election, Trump held two rallies for Hyde-Smith in an attempt to turn out the Republican base.

He told the crowd in Tupelo to "get out" and vote in Tuesday's runoff.

"I think it'll be a very big day for Cindy, but don't take any chances," he said. "That's happened many times before. That never works out well. Just assume you have to vote."

Even though Republicans will control the Senate regardless of the outcome, the President suggested that a Democratic win in Mississippi would "revoke" the party's victories.

"We cannot allow Nancy Pelosi and Chuck Schumer to revoke that victory by winning the state of Mississippi," he said.

At a roundtable in Gulfport, Trump called Hyde-Smith's comments about a public hanging "sad and a little flip."

"When I spoke to her -- she called me -- she said, 'I said something that I meant exactly very different,' and I heard an apology loud and clear," Trump said.

"I know where her heart is, and her heart is good. That's not what she was meaning when she said that," he said.

Hyde-Smith at center of controversy

Though public polling has been limited, the race is seen as potentially competitive because of Hyde-Smith's "public hanging" remarks.

Those comments prompted deeper dives into her history.

The same progressive blogger who published the video of her using the phrase "public hanging" later published one in which Hyde-Smith told a small group at Mississippi State University that suppressing the votes of students at other colleges was "a great thing." Her campaign said it was a joke, but that explanation backfired when the black student from the event seen laughing in a picture her campaign posted on Twitter responded that Hyde-Smith's campaign was using him as a prop.

On Friday, the Jackson Free Press reported that Hyde-Smith had attended a private high school that was founded in 1970 so that white parents could avoid attempts to integrate public schools. Hyde-Smith's daughter later attended a similar private school established around the same time, according to the Free Press. The senator's campaign responded to the report by attacking the "liberal media."

Over the weekend, CNN reported that Hyde-Smith once promoted a measure that praised a Confederate soldier's effort to "defend his homeland" and had pushed a revisionist view of the Civil War.

In photos posted to her Facebook account in 2014, Hyde-Smith was pictured posing with Confederate artifacts during a visit to Beauvoir, the home and library of Confederate President Jefferson Davis. The caption on the post read, "Mississippi history at its best!"

Espy's campaign hammered Hyde-Smith with television ads that cast her as an embarrassment to a state that has attempted to overcome its history of slavery and racism.

"We've worked hard to overcome the stereotypes that hurt our economy and cost us jobs. Her words should not reflect Mississippi's values, either," a narrator said in one ad. The ad also called Hyde-Smith "so embarrassing, she'd be a disaster for Mississippi."

Several companies that had donated to Hyde-Smith's campaign, including Walmart, publicly withdrew their support for the senator over the "public hanging" comment.

In her debate with Espy, Hyde-Smith said she would "certainly apologize" to anyone who was offended by her remark. But she quickly pivoted into attack mode.

"I also recognize that this comment was twisted and it was turned into a weapon to be used against me," she said.

GOP fights to avoid embarrassment

The controversies surrounding Hyde-Smith set off a major push by national Republicans to avoid the same embarrassment they'd suffered last year in Alabama and save Hyde-Smith.

While Hyde-Smith largely stayed off the campaign trail, the party's infrastructure rallied to her defense. GOP groups spent $4 million on the Mississippi runoff -- much more than Democrats' $1.2 million, according to Federal Election Commission filings. Republican groups spent more than twice as much as Democrats on television advertisements, per the ad tracking firm Kantar/CMAG.

Trump's visits to Mississippi on Monday night were also seen as bid to rally the Republican base to vote in an election taking place two days after the Thanksgiving weekend.

For Democrats, the best-case scenario is similar to how Democratic Sen. Doug Jones defeated Republican Roy Moore in Alabama a year ago: a narrow victory fueled by massive turnout from black voters.

But Mississippi is, in some ways, more challenging than Alabama. Moore faced allegations that, as an adult, he had sought sexual relationships with teenage girls.

And the state is more rural than its eastern neighbor. Like Alabama, Mississippi hasn't voted for a Democrat in a presidential election since Jimmy Carter in 1976. Trump won Mississippi by 18 percentage points in 2016.