From Barack Obama's campaign headquarters in Chicago you can look out over Grant Park, down Lake Shore Drive (''now we're tripping on LSD'', taxi drivers like to say as they pull onto Lake Shore) to the McCormick Centre, where the President claimed his victory early on Wednesday morning.

Obama made his address to a wall of jubilant sound, but there was a noticeable explosion of cheering when he thanked his campaign staff.

''To the best campaign team and volunteers in the history of politics, the best, the best ever,'' he began, ''no matter what you do or where you go from here you will have the lifelong appreciation of a grateful president.'' The crowd, many of them staff or volunteers, sang and cheered, chanted and wept.

As this election's entrails are being picked over there is a growing suspicion that the rhetoric might match the reality.

Advertisement

Obama's campaign had pulled off a trick political professionals normally fantasise about. Using some of the most sophisticated campaigning technology ever created they reshaped the electorate to suit their candidate.

When he was appointed to lead the President's re-election campaign at the beginning of last year, Jim Messina, who had been the White House deputy chief of staff, knew he faced some serious problems. Months of warfare with a Republican House of Representatives determined to block any measure put forward by the White House had tarnished the President and the Democrats had just been clobbered in the 2010 mid-term elections.

The US was in debt and deficit, housing prices had not recovered and unemployment was high. Research suggested that if the same voters turned out in 2012 as in 2008, Obama would lose.

In these circumstances Obama's soaring rhetoric was inappropriate. It was also going to be difficult to campaign on the President's record. Though he had arguably just helped avert a depression, Messina was aware ''it could have been worse'' is not a selling point.

Then there was the money. The Supreme Court had scrapped restrictions on political donations and Wall Street was seething with resentment at new regulations introduced by Obama. As a result Messina expected a cashed-up Republican movement to direct a river of cash into its advertising campaign. To help overcome these problems he launched a secret project, codenamed Narwhal.

Obama in full flight at a Nevada rally and the re-elected President’s tweet victory. Photo: Reuters

The 2008 campaign led by David Axelrod - a senior member of this year's team - was famous for the way it harnessed a massive network of volunteers across the country and collected information from them - demographics, spending and donation habits, political concerns, voting habits.

The problem was that the databases in Chicago could not talk to one another. The donations team kept its data separate from the political team's, which could not access the voter registration campaign team's database.

Messina's first task was to marry the databases. He raided Silicon Valley for its best and brightest, appointed a chief scientist and moved the new staff into the growing offices in Chicago to write new code.

Once the database was built and the 2008 campaign's sea of information reconciled, new data was pumped in. The campaign bought consumer databases and accessed the various state voter registration agencies. At campaign rallies more names and numbers were gathered and fed into the machine.

The 2008 volunteer networks were revived and training programs began a full year before the election. Once the volunteers were in the field they began gathering and reporting more information on the electorate.

On January 22 a young woman in Ohio received an email from Obama's Chicago headquarters telling her the President's healthcare reforms would mean contraception was fully covered by insurance, Slate magazine reported.

Obama's datamine was at work. The email had been crafted specifically for her, a young, liberal, single woman living in a socially conservative part of a crucial state.

In spring, as the campaign kicked into high gear, Obama's dataminers noticed that women on the west coast between 40 and 49 would hand over donations for the chance to have dinner with Obama and George Clooney, Time has reported.

The fund raisers wanted to repeat the success of the Clooney fund raiser on the east coast, so they turned back to the machine to find out which celeb would attract the same demographic. Soon the campaign was offering donors a chance to dine with the President and Sarah Jessica Parker.

By mid-year volunteer networks had grown and were in operation across the country. Volunteers were being charged with contacting crucial segments of the voting population, especially those identified as ''persuadable'' or ''sporadic''. Rather than wasting their time fruitlessly door-knocking the uninterested, volunteers had been provided with a smartphone application that told them which household on which street to target, and allowed them to immediately send a report back to Chicago. Volunteers were encouraged to check their app if they found themselves with a few minutes to spare - there might be persuadables to call or visit.

Supporters were contacted via Facebook and told which of their friends had not registered to vote, and Chicago discovered that one-in-five people contacted by someone they knew acted on the request, a much higher strike rate than that achieved by cold-calling or direct mail.

''We turned a national election into a school-board race,'' a senior Obama campaign official told The Washington Post.

This was the backbone of the campaign's strategy of targeting Hispanic, African-American, female and young voters to overcome the President's falling popularity among southern white men. Last Thursday, as polls showed the race in a dead heat, Messina and the campaign's national field director, Jeremy Bird, held a conference call with reporters to detail the strategy for the last days of what they called the ''ground game'' - the sprint to gather the last possible votes in the key counties of the key states, and to ensure their supporters turned up and voted.

Despite the polls, both men burbled with confidence as they ran through a stream of numbers, boasting that their network of 700,000 volunteers had made 125 million face-to-face or phone contacts with potential voters, registered 1.8 million new voters and encouraged 28 per cent of them to vote early - 345,000 in key states.

The early voting campaign was particularly important - once someone had voted, the neighbourhood volunteer hub could scratch their name off the list and concentrate on those who had not.

Weirdly, the Romney campaign was sounding equally confident. Perhaps spooked by the stories about the omnipotent Narwhal oozing out of Chicago, Romney's Boston headquarters had launched its own data project late in the game and named it Orca - a larger aquatic mammal than the narwhal of the Arctic.

''The project operates via a web-based app volunteers use to relay the most up-to-date poll information to a 'national dashboard' at the Boston headquarters,'' a campaign email boasted last week. ''From there, data will be interpreted and utilised to plan voter turnout tactics on election day.''

The problem was, Orca got critical things terribly wrong at crucial times. According to a Washington Examiner report, it was still predicting a crushing Romney victory as late as 4pm on election day.

''Somebody said Orca is lying on the beach with a harpoon in it,'' an aide told the Examiner.

''I don't think anyone on our side understood or comprehended how good their turnout was going to be,'' Henry Barbour, a Republican committee man from Mississippi told the Huffington Post.

''The Democrats do voter registration like a factory, like a business, and Republicans tend to leave it to the blue hairs.''

Orca's predictions perhaps explain the genuine shock in the Romney campaign when the states began tumbling against them on election night.

Meanwhile, the Chicago operation was making Messina look like an oracle. He correctly predicted that Obama would win the Latino vote by 71 per cent and that the minority turnout would be 28 per cent of the vote, and that Obama would win 80 per cent of it.

Back in January a Newsweek reporter visited the Chicago headquarters to explore the mine, and found a staff committed to protecting its secrets. Messina, whose appointment over Axelrod had raised eyebrows, seemed to be in his element.

Taped to one of the technician's Macs was a photo of Messina bearing the slogan, ''Everybody chill the f--k out, I got this.''

Four years ago the same line had bounced around the internet attached to a photo of Barack Obama.