The sense of optimism among Democrats had been building all evening: a nervous hopefulness at first, with fingernails digging into palms, gradually edged out by something closer to confidence. Everyone anticipated a draining night.

But it was earlier than almost anyone expected – 11.12pm on the east coast – when NBC, followed immediately by CNN and Fox, called the state of Ohio for Barack Obama, effectively ending the uncertainty.

In a bland suite at Chicago's Fairmont hotel, the Obamas and Bidens embraced; four miles away, the McCormick Place convention centre erupted with ear-splitting screams. At what had been billed as Mitt Romney's "victory party", in a modest ballroom at the Boston convention centre, there was silence – while on Fox News, Republican strategist Karl Rove became a symbol of the collision between reality and his party's beliefs, refusing to accept his own network's account of what happened.

It was another half hour before Romney called Obama to concede, and it was at about 1.30am eastern time that the re-elected president arrived on stage at his victory rally, flanked by his wife and daughters, to the strains of Stevie Wonder's Signed, Sealed, Delivered.

Obama looked exhausted and grey-haired, but proved as energetic as he had ever been. America "moves forward," he told the ecstatic crowd, "because you reaffirmed the spirit that has triumphed over war and depression, the spirit that has lifted this country from the depths of despair to the great heights of hope, the belief that while each of us will pursue our own individual dreams, we are an American family, and we rise or fall together as one people."

He thanked "the woman who agreed to marry me", his daughters, his vice-president, and "the best campaign team and volunteers in the history of politics," and praised the Romneys for choosing "to give back to America through public service".

He thanked those who had queued for hours to vote – and "by the way, we have to fix that." America, he concluded at 2am, in rhetoric of a kind unheard during the long campaign, was "not as divided as our politics suggest. We're not as cynical as the pundits believe. We are greater than the sum of our individual ambitions, and we remain more than a collection of red states and blue states."

Earlier on Tuesday, Romney had claimed only to have written a victory speech – and it showed. The concession speech he delivered shortly before Obama's victorious one was indisputably gracious: "I pray that the president will be successful in guiding our nation," he said, to civil applause.

But for a man who had been running for president virtually full-time for five years, it felt oddly empty: no big ideas, no hints of his deepest motivations for having tried to reach the White House. After the customary "God bless America," Romney's last words – perhaps his last ever on a national political stage – were: "Thanks, guys." Then he strode off to embrace his wife and sons.

The surprisingly short election night had begun in earnest six hours earlier, when voting officially concluded in the first six states. Because of their role in declaring the state-by-state outcome before all votes are counted, US TV networks did not cover the evening's events so much as create them – and they did so cautiously, still haunted by the memory of calling Florida prematurely in 2000.

Even their studio sets seemed relatively restrained, notwithstanding CNN's gimmick of projecting red and blue lights on the Empire State building in proportion to the unfolding tallies. (The worst night was ABC's: its studio suffered a prolonged power cut, while host Diane Sawyer – her demeanour variously described as "off-kilter" and "fatigued" – fell into abrupt silences, and mispronounced Obama's name.)

The first calls were no-brainers – Kentucky for Romney, Vermont for Obama – but CNN's Wolf Blitzer welcomed them with an excitement it seemed unlikely he would be able to sustain until sunrise.

Fortunately, he did not have to. Soon after 9pm, Pennsylvania was declared for Obama, ending the talk – always implausible – that Romney might have had a chance there. Obama won Wisconsin and pulled off a more surprising victory in New Hampshire, and the tone of the night began to change. Romney's victory in North Carolina prompted cheers in Boston but, by then, Democrats had allowed themselves to exhale. A trickle of good news from the Senate kept them buoyed: by the end of the night, America would have elected its first openly gay senator, Tammy Baldwin, in Wisconsin and the leftwing hero Elizabeth Warren in Massachusetts, while denying office to Todd Akin and Richard Mourdock, the two Republicans whose remarks on rape had angered many. And Maine and Maryland became the first states to approve gay marriage by popular vote, rather than a court decision.

As the night unfolded, it was becoming clear that there was another major winner besides Obama: data. The race had been characterised by a standoff between those who championed swing-state polls, showing a slight but steady Obama lead, and those whose "gut" told them the race was a dead heat, or going against the president. For much of the campaign, Fox pundits spun a version of reality in which a Romney landslide was looming. But on Tuesday, at last, everyone was forced to depend on the same set of facts.

"So far, what we've seen," said Fox's Megyn Kelly, "is that the polls were right." "Yes," her grave-looking co-host Brit Hume agreed. "It's a perplexing time for many of us right now if things continue in this trend," Sarah Palin told the network. (Afterwards, she would call Romney's defeat a "catastrophic setback".)

Around the time the last polls closed, at 11pm, the Denver Post newspaper, to the surprise of many, called Colorado for Obama. But Romney supporters at the Mile High stadium overlooking Denver tried to keep their spirits up. "I'm nervous, but full of hope," said Cathy Swartwood, gazing at a TV screen. "It's the first time I'm afraid for my country. Obama is taking us in the direction of socialism."

Rove's refusal to accept Fox's decisive Ohio decision, at about 11.15pm, prompted a surreal dispute between the network and George Bush's former right hand man, whom it employs as a commentator. His sources in the Romney camp, he insisted, were not ready to concede the state yet. Kelly, declaring the standoff "awkward", set off down the studio's back corridors, a camera following her, to confront the network's statisticians.

As Democrats celebrated, the Republican recriminations were beginning. Some argued that Romney had been insufficiently rightwing; others that the party's failure to appeal to Latino and younger voters explained the loss. The most comforting option – though the polling data did not support it – was to blame Hurricane Sandy, and New Jersey governor Chris Christie, who had vocally praised Obama's response to the storm.

On Twitter, meanwhile, Donald Trump called for a "march on Washington" and a "revolution", while the most unpleasant instant response probably came from Fox's Bill O'Reilly: "Obama wins because it's not a traditional America anymore. The white establishment is the minority. People want things."

There was grudging respect for the Democratic "ground game" – "Barack Obama is one of the greatest politicians in American history," wrote the conservative John Podhoretz. "After … [2008's] vague message of hope and change, he has just shifted gears and won a second term with a tough-minded, hard-grinding state-by-state get-out-the-vote effort that overcame this fundamental fact: he shouldn't have won at all."

But he had – and comfortably ahead in the popular vote, too. Before long, the cable-news arguments over Ohio were rendered decisively irrelevant: Obama's victory in Colorado was confirmed, and Nevada was added to his column. Apart from North Carolina – and Florida, where he held a slim lead, but where counting continued on Wednesday – he had swept all the swing states. Speaking at McCormick Place, Obama made clear his belief that the four years ahead would be challenging ones. But for one night, at least, his supporters permitted themselves the deepest of sighs of relief.