A bitterly divided country deadlocked in a 269-269 Electoral College tie turns to the House of Representatives to select the next president.
The unusual constitutional scenario is considered so far-fetched -- it hasn't happened since 1824 -- that it was written into the plot of the fifth season of HBO comedy series "Veep" and its send-up of the political class.
"I don't want to end up in the Supreme Court and I don't want to go back to Congress either, even though we have an advantage," Trump said of the election at a Sept. 26 Pennsylvania rally.
Pelosi fired back in a letter to House Democrats two days later, encouraging members to support candidates in "key districts" across the country.
"If Trump can't win at the ballot box, he wants the House to deliver him the presidency," she wrote. "It's sad we have to plan this way, but it's what we must do to ensure the election is not stolen."
Republicans hold advantage in the House
Under the Constitution's 12th Amendment, the House would select the next president and the Senate would pick the vice president if no candidate has a majority of Electoral College votes.
By law, states have until Dec. 8 to certify their results or have the state legislature appoint electors to the Electoral College, which is set to convene on Dec. 14. Congress is set to formally count electors' votes and declare a winner on Jan. 6.
In the scenario of a tie, each state would only have a single vote in the House of Representatives. The party with more House seats would determine the presidential vote.
Republicans control 26 state delegations, while Democrats hold 23. Pennsylvania is split between both parties, and Republicans also have a chance to break even with Democrats in Michigan and Minnesota if they capture one additional seat in each state.
That math is on the minds of Democratic leaders, donors and strategists in the final weeks of the election. With most Democratic candidates in Trump-leaning districts flush with cash and leading Republican challengers in public and private polling, the party is working to expand the map and give the party a broader path to securing their House majority.
That includes investments in suburban contests in Michigan, Pennsylvania and Florida, but also in newly competitive races in rural Montana and Alaska, which each have a single seat in Congress and were carried by Trump by 15% to 20% in 2016.
Democrats control the delegations of several competitive presidential battleground states -- such as Arizona, Iowa, Minnesota and Nevada -- by a single seat, while Republicans have a single-seat advantage in Florida.
Pelosi 'prepared' for every election scenario
Pelosi decided to acknowledge the scenario of the House deciding a contested election in a public letter to colleagues after Trump repeatedly mentioned the possibility and amid his refusal to commit to a peaceful transfer of power.
"I had been working on this for a while. I've been working on almost every scheme he might have to steal the election. And kind of sub rosa -- since he went public, then so did I," she said in a late-September MSNBC appearance of Trump's comments about the House determining the outcome of the election.
In addition to signaling Democrats' preparations for any election outcome, Pelosi's comments also served as a reminder to Democrats and donors not to lose sight of competitive House races amid the presidential contest.
"It's helpful to remind donors and other groups that the presidential race gets a ton of attention, the Senate gets a ton of attention, and we have to take all of the steps available to us to make sure we aren't missing these opportunities," Caitlin Legacki, the communications director for the Democratic House Majority PAC, told ABC News, referring to securing more seats in the House.
Kyle Kondik, the managing editor of Sabato's Crystal Ball, a political newsletter published by the University of Virginia Center for Politics, said it would be "unlikely" the presidential race would end in an Electoral College tie, noting Biden's consistent lead over Trump for several months in national and battleground state polls, but sketched out several possible scenarios based on the results of the 2016 election.
One would involve Biden winning every state carried by 2016 Democratic presidential nominee Hillary Clinton, flipping Michigan and Pennsylvania and carrying the electoral vote from Nebraska's 2nd Congressional District. (Nebraska and Maine, unlike other states, award Electoral College votes by congressional district in addition to allocating electoral votes to the state's popular vote winner.)
But a world where Democrats are in position to retake House seats in Alaska and Montana and win control of their delegations, he added, is "a world in which Biden is over 270 electoral votes" -- making the balance of the House moot in determining the next president.
Derek Muller, a law professor at the University of Iowa who wrote about the issue ahead of the 2016 election, called the possibility of the House determining the next president "very unlikely" in an era of two major political parties.
"Those scenarios come closest when it looks like a third party swoops in and captures some set of electoral votes that sort of deprives the winner of a majority," he said, pointing to the results of the 1824 presidential election - when a race between four candidates led to a deadlock, and eventually, the House selecting John Quincy Adams as president.
"It remains a possibility, but I think a very remote one," Mueller said.
David Mandel, who served as showrunner and executive producer of "Veep," isn't losing sleep over the odds, either.
"Nothing shocks me, but of all the many, many things that come to fruition on Planet Earth that may hit first, this is the least of them," Mandel, a Democrat who has helped raise money for the party, told ABC News.
Electoral College complications
Short of an Electoral College tie, election experts have pointed to several other improbable scenarios that could throw the White House race into chaos into January, when Congress certifies results.
While 32 states and the District of Columbia require presidential electors to pledge their votes to the winner of the popular vote in their states, "faithless" electors could refuse to vote for the candidate who wins the popular vote.
Another concern is the possibility of disputed results in certain contested states with divided governments -- such as Pennsylvania, Michigan and Wisconsin, which have Democratic governors and GOP-held legislatures.
If the leaders of divided states can't agree on the results of the election, they could each send their own slate of electors to Washington, leaving it up to party leaders to determine which group to recognize from a given state.
"There's a difference between Congress having to make the decision about which votes to count, which would give a candidate 270 or more, and then its decision if nobody gets to 270," said Muller, who downplayed the likelihood of that possibility.
It's only happened once since the 1800s: In 1960, Hawaii sent two groups of electors to Washington, and Congress eventually recognized the Democratic electors. But Hawaii's electoral votes wouldn't have changed the outcome of the race between then-Sen. John F. Kennedy and Vice President Richard Nixon.