WASHINGTON — In the dark of night, when they get what little sleep they get these days, the people running the campaigns for president have more than enough fodder for nightmares. Worse, come daybreak, they realize their worst fears may yet come true.
Dancing in their heads are visions of recounts, contested ballots and lawsuits. The possibility that their candidate could win the popular vote yet lose the presidency. Even the outside chance of an Electoral College tie that throws the contest to Congress.
Now add to that parade of potential horrors one more: a freakish two-in-one storm that could, if the more dire forecasts prove correct, warp an election two years and $2 billion in the making.
Despite the meticulous planning, careful strategies, polling, advertising and get-out-the-vote efforts, the election could produce the sort of messy outcome that defies expectation and prognostication. Polls show such a tight race between President Obama and Mitt Romney heading into this final week that the two sides are playing out any number of wild possibilities.
The approach of Hurricane Sandy reminded them just how out of their control democracy can be.
"Obviously, we believe the more people participate in the election, the better," said David Axelrod, the president's senior strategist, "and the storm can be disruptive. But to the 50 million people in its path, there are more immediate and potentially grave concerns that transcend politics. We'll have to wait and see its impact."
The storm forced both candidates to scrap campaign stops and, with eight days until Election Day, will require Mr. Obama to balance the roles of president in an emergency and candidate. That could benefit or hurt him, depending on how voters view his performance, and distract from efforts by both camps to advance a closing argument.
Early voting, which Mr. Obama has counted on to bolster his chances of a second term, will most likely grind to a halt in some places along the Eastern Seaboard, while power failures could last much of the week and conceivably until Election Day in some places. It went unnoticed by no one that Virginia, among the most tightly contested states, may be among the most affected.
Meteorology is only one wild card facing the campaigns in the final week. On Election Day, the winner may not be known right away; results in one or more states may be close enough to merit recounts. In Ohio, which could decide the election, so many provisional ballots may be cast — and by law are not counted right away — that it may be mid-November before a winner is declared.
"The Boy Scout motto comes in handy — be prepared," said Bradley Blakeman, a Republican strategist and veteran of George W. Bush's recount fight in Florida. "I know that lists of local lawyers and national legal talent are amassed and will be deployed if need be. After the recount in 2000 and the nail-biter in 2004, the G.O.P. is ready with multiple scenarios already modeled."
The campaigns are so worried about every electoral vote that a pro-Romney "super PAC" even invested in ads in Maine, a largely Democratic state, because it allocates some electoral votes by Congressional district and Republicans have a chance of picking up a single vote there.
Of all the messy outcomes, the one that seems likeliest is a candidate's winning the presidency through the Electoral College despite losing the popular vote, as Mr. Bush did in 2000. If it happens again, it might be in the opposite way, with the Republican, Mr. Romney, in range of a popular plurality and the Democrat, Mr. Obama, with an apparently easier route to an Electoral College victory.
Charlie Cook, a well-known political handicapper, said the chance of that happening was 10 to 15 percent. Stanley B. Greenberg, a longtime Democratic pollster, put the odds at "one in three."
"Not trivial," Mr. Greenberg said of the chances. "If that happens, it is because the anti-Obama vote, mostly in the South, turns out in big numbers," while the pro-Obama vote is not as overwhelming in Democratic states but pulls him over the top in vital places like Ohio, Iowa and Nevada.
If Mr. Obama wins a second term while losing the popular vote, it would again throw a harsh spotlight on the Electoral College, an artifact of the 18th century. Each state has one elector for each of its members in the House and Senate. With 538 electors, it takes 270 to win. If no one does, the House decides who will be president.
In 1800, Thomas Jefferson and Aaron Burr received the same number of electoral votes. The House sided with Jefferson. In 1824, none of four candidates received an electoral majority, and John Quincy Adams won in the House although he trailed Andrew Jackson in both the popular and the electoral votes.
Two other presidents, Rutherford B. Hayes in 1876 and Benjamin Harrison in 1888, won in the Electoral College even though they lost the popular vote.
The Electoral College has been attacked almost from the start. Over 200 years, more than 700 proposals to eliminate or revise it have been introduced in Congress, and more constitutional amendments have been proposed to change the system than on any other subject, according to the National Archives. A Gallup poll last year found that 62 percent favored a constitutional amendment making the popular vote decisive.
"If you were to have a repeat of that except the popular vote winner was the Republican and the Electoral College winner was the Democrat this time, then you would have had each party burned by the Electoral College over the course of 12 years, and that might be conducive to a serious look at reform," said Robert W. Bennett, a Northwestern University law professor who has written extensively on the Electoral College.
Less likely is a tie, 269 to 269. If that happened, strategists envision an intense postelection campaign of state-by-state recounts, lawsuits, qualification challenges, efforts to flip electors, horse trading and pressure on members of Congress. The result would be a highly volatile 11-week obstacle course to Inauguration Day that would leave the country uncertain for a time about its next president and potentially undermine the credibility of the winner.
"If this election does require some extra innings, we have plans in place to deal with that," said Bill Burton, a former Obama aide and co-founder of a super PAC supporting the president. "But the odds of that are infinitesimally small."
If recounts did not change any Electoral College votes, both sides could lobby electors to switch before they met in state capitals on Dec. 17. While more than half the states have laws intended to force electors to cast ballots for the popular vote winner in their states, there have been "faithless electors." In 2004, a Democratic elector in Minnesota wrote in John Edwards's name instead of John Kerry's.
If no electors flipped, the issue would go to the newly elected House. Each state gets one vote, meaning that Delaware has the same power as California. In the current House, Republicans control 33 delegations, while Democrats have 16 and 1 is split. Few analysts believe the election will change the House enough to shift that balance.
That would give Mr. Romney the advantage, although pressure would intensify if Mr. Obama won the popular vote. But even if Mr. Romney wins in the House, there is an extra wrinkle: The vice president would be chosen by the Senate, which may remain in Democratic hands.
If the Senate is deadlocked, the tie could be broken by Vice President Joseph R. Biden Jr., presumably voting for himself.
And the nation could wind up with President Romney and Vice President Biden.