Recounts and legal challenges can take months to play out in some cases, but not in the election of a president: the Constitution sets strict deadlines, and not just the date for the inauguration.
There have been some long fights for office elsewhere. When Norm Coleman of Minnesota ran for the U.S. Senate in 2008, the election night count showed him beating Al Franken by a mere 725 votes. That triggered a process of recounts and court battles that played out for eight months. Al Franken wasn't sworn in until July 2009.
In Washington state, Dino Rossi gave up fighting seven months after it appeared he'd been elected governor in 2004 by a margin of 261 votes, when a third recount declared Christine Gregoire the winner.
Here are five things to know about contested elections.
1. In the event of a close vote, state law determines how recounts work.
Nearly every state allows for a recount when the margin of victory is very narrow. Only Hawaii and Mississippi do not: if the apparent loser isn't happy with the results in those two states, the only recourse is going to court.
For the rest of the country, the rules vary.
In 20 states and the District of Columbia (which has three electoral votes), recounts are triggered automatically if the margin is below a specified threshold — usually one percent or less. This group includes three states where the vote for president may be close — Arizona, Florida, and Ohio.
Automatic recounts are triggered only when the vote is a dead even tie in Alaska, South Dakota, and Texas.
In 42 states, candidates themselves can seek a recount, though they have to pay for all or part of the cost unless they turn out to be the winners. But in Arizona, Connecticut, Florida, New York, South Carolina, and Tennessee, candidates cannot request a recount.
2. Losing candidates can go to court to contest the election.
State laws set out the grounds for contesting the election results by challenging them in court. Candidates can claim that election procedures weren't followed or that fraud was committed. It isn't enough to cite a generalized belief that something went wrong. Courts demand specifics.
Contest laws allow claims that fraud or irregularities changed the outcome of the election or at least put the results in doubt, by disregarding votes that should be counted or by counting votes that should be thrown out. Possible allegations include claims that ballots were cast by people who weren't qualified to vote, absentee or overseas ballots were wrongly tabulated, or voting machines were improperly programmed.
When the vote in a state is very close and every paper ballot is inspected, losing candidates may claim that ambiguously marked ballots were wrongly counted or discarded. In 2010, Republican US Senate candidate Joe Miller went to court claiming that Alaska officials improperly counted write-in votes for Lisa Murkowski that misspelled her name. A judge ruled that because voter intent was the most important factor, spelling variations would count.
3. The amount of time for recounts and contest in a presidential election is strictly limited.
The Constitution gives Congress authority to specify the day when each state's electors, those chosen in November, must meet and cast their electoral votes. Congress has made that day "the first Monday after the second Wednesday in December."
Because there's also a law that specifies when the popular vote is cast — the Tuesday after the first Monday in November — that leaves a period of five weeks and six days for each state to resolve any disputes over the election results, through recounts and election lawsuits.
But there's an even tighter deadline.
A 129-year-old federal law, known as the "safe harbor" provision, says Congress must count a state's electoral votes if any disputes over who won are settled six days before the electors meet. As a practical matter, states really have only five weeks for resolving disputes.
4. The safe harbor provision was a factor in the disputed 2000 election between George W. Bush and Al Gore.
The U.S. Supreme Court issued its decision in Bush v Gore on December 12, 2000, six days before the electoral college was to meet on December 18.
The court's decision said the Florida Supreme Court had ruled earlier that the state legislature intended to take advantage of the safe-harbor provision. That meant, the justices said, that the recount issue could not be sent back for another round in court, because time had run out.
5. Congress decides whether to count the electoral votes from a state that misses the deadline.
States are understandably reluctant to gamble with missing the safe harbor date, which could put their electoral votes in danger of not being counted. But one comparatively modern example suggests the danger could be low.
Two days after Hawaii's election for president in 1960, John F. Kennedy was ahead of Richard Nixon by 92 votes out of more than 184,000 cast. The final tally, after the votes were canvassed, gave the victory to Nixon. The state's electors met in mid-December and voted accordingly.
But after a long legal battle, a judge ordered a statewide recount, and Kennedy was certified the winner. The state then chose a new slate of presidential electors.
When Congress met to count the electoral votes, the joint session was presided over by the vice-president -- Richard Nixon. He said that even though Hawaii sent in two separate slates of electors, the second one reflected political reality. He asked if there were objections and there were none, so the Kennedy votes were counted.
Perhaps Nixon's magnanimity stemmed from the fact that Kennedy beat him by 84 electoral votes, and Hawaii's three votes made no difference. But by any measure, his statement in announcing the victory of his opponent was a gracious one.
"In our campaigns, no matter how hard fought they may be, no matter how close the election may turn out to be, those who lose accept the verdict and support those who won."