The election the world thought would never end at least began predictably – an hour and 50 minutes after the last one was over.

This was how long it took one presidential hopeful, Kentucky senator Rand Paul, to first start campaigning against Hillary Clinton when polling closed two years ago in the midterm elections. It was to prove almost the only thing that went to script. What happened next would change the certainties of American politics forever.

That a woman might become a major party nominee and then president of the United States was seen as a historic enough opportunity: a moment to prove once and for all that no job should be a male preserve and no woman need curb her ambition. Yet almost everyone assumed Clinton would be squaring off against one of a pack of Republican politicians.

It was hard to conceive that she might stumble on her way to this feminist showdown thanks to Bernie Sanders, a self-described socialist who nearly upended the Democratic party primary. Even more implausibly, Donald Trump, a television reality show host and property developer who was neither a politician nor, arguably, a Republican, would sweep all of his primary election rivals aside in a landslide. No scriptwriter could have imagined how close this would lead America toward what many critics came to fear was a form of fascism.

Trump was labelled with other ‘isms’ too – racist, sexist, nationalist – some of them even by his own supporters; all of them disputed by him. But it was his fondness for authoritarianism and flair for demagoguery that led most to unflattering comparisons with the political landscape of the 1930s. Who could have guessed that with some deft mutations for the media age, this virus would come so close to overwhelming the world’s most powerful democracy in the 21st century? Or how grateful many Democrats would be that the American strain arrived wrapped up in a candidate with such obvious flaws?

Theories abound for why Trump decided to run for office. Some say he was stung into action by a humiliating tongue-lashing he received from Barack Obama at 2011 White House correspondents’ dinner. Witnesses to the event differ on whether Trump was goaded into seeking revenge or merely flattered by the attention, but he was teased mercilessly for trying to prove the president was born in Kenya. This unlikeliest of public servants began his political life as the anti-Obama candidate, seeking to ride the swinging pendulum away from a high point in racial equality and shifting into opposition to the equivalent moment in women’s emancipation.

It was a crowded field. Former Florida governor Jeb Bush was long seen as the Republican frontrunner and raised more money within weeks than his self-described billionaire opponent was ever to contribute to the presidential campaign. Yet Bush was to flop disastrously at the first brush with actual voters. His measly three delegates in the Republican primary election – 0.2% of the total needed to secure the nomination – were to cost $50m a piece. Fifteen other candidates copied his ignominious exit from a one-sided Republican primary that felt like an election all of its own.

Eight of the Republican candidates – not even half the field. Photograph: Getty Images and Rex Features

Despite failing against Barack Obama in 2008, Clinton’s coronation as the Democratic nominee looked so preordained that some worried whether the party would ever find a serious candidate to run against her in the primary at all. Massachusetts senator Elizabeth Warren was petitioned by many on the left and resisted. Sanders, an independent Vermont senator, stepped forward instead – at first with little hope of winning much beyond his home state, but determined there should at least be a debate about a more progressive alternative to the centrism traditionally associated with the Clinton family.

The 74-year-old was to win 22 states and ride a tidal wave of enthusiasm rarely seen in politics. Fueled by anger over economic inequality and corruption, this gruff outsider came close several times to achieving enough momentum to pull off a victory that would have made Trump’s nomination look tame. Like the reeling Republicans, the Democratic party too was convulsed by a wave of populism it first seemed ill-equipped to recognise, let alone respond to.

Though a generation of young white supporters “felt the Bern”, his campaign nonetheless never reached escape velocity. Quite apart from its shocking radicalism (at least by modern American standards), it was held back by a lack of early media coverage, limited support among African American voters in the south and determined resistance from the party hierarchy. Despite conspiracy theories to the contrary, Clinton was to win nationally by a clear and convincing majority.

But the long, and sometimes bitter, Democratic primary showed its eventual nominee’s vulnerabilities just as much as it also helped shift her manifesto to the left in ways even Sanders could once only dream of. Most of all, it demonstrated the country’s desire for change.

New and uncharted territory

The electorate’s anti-establishment mood in 2016 can be tracked most clearly by the waves of support for Trump, who vied with Clinton in generating historic unfavourability ratings among voters but also came close to catching up with her in popularity several times.

With hindsight, national opinion poll averages show cycles of support that almost look like oscilloscope waves in their regularity. Seven times in 14 months, Trump would surge from a position of distant underdog to draw close to, and sometimes even fractionally ahead of, his opponent – before slipping back again as the country contemplated the shocking implications. Never once was he convincingly out in front.

Most recently, this bi-monthly rhythm turned just in time to coincide with the election, when WikiLeaks and the FBI raised new questions about Clinton’s past. Before that, it was the sight of her nearly collapsing in public, a bombastic Republican convention, and an earlier bout of email scrutiny that marked similar upswings in Trump’s fortunes.

For Republicans, there were many more heart-in-mouth moments as the polling rollercoaster took a downward lurch in response to some shocking outburst or revelation.

Disappointing debate performances, tax scandals, and the emergence of a video of him boasting of groping women helped trigger the last downturn in Trump’s hopes, while attacks on the family of a Muslim war hero and allegations of defrauding students were moments that popped earlier polling bubbles.

But the ebb and flow of poll numbers and news headlines only captures some of the drama of the 2016 election. Like many political journalists, I traveled tens of thousands of miles on the campaign trail over the past couple of years, covering more than 100 political rallies, conventions and debates in 28 states – even then, just a fraction of the distance clocked by the candidates.

With hindsight, the scenes that stand out, witnessed in person or on television, are mainly the ones that did not fit into the horse-race commentary of who was in front or behind: a binary narrative that seemed so important at time, but irrelevant compared to this week’s actual voting. The highlights instead were the moments when it became apparent America had left the railing and was heading off into some entirely new and uncharted territory.

Trump first descended the golden escalator of his Manhattan skyscraper into a flock of reporters hungry for excitement. Compared to the meagre gruel that Republicans had fed the media before his candidacy, this flamboyant 69-year-old made news from the moment he opened his mouth.

An elevator descent into madness. Photograph: Christopher Gregory/Getty Images

Where others had sought, for example, to rehash obscure details of Clinton’s role during the 2012 Benghazi terrorist attacks, here was someone who spoke in single-syllable soundbites that made little sense, but loud headlines. “I would build a great wall, and nobody builds walls better than me,” began his announcement speech in 16 June 2015.

By contrast, Clinton’s formal debut before an expectant media in April of that year was polished and professional but lacking in big ideas. An excited press pack chased her across the plains of Iowa in a bus they dubbed the “Scooby van”, only to discover a tightly disciplined campaign nothing like the cartoon playing on the other channel.

Trump also immediately showed a remarkable gift for offending people. In the same first speech, Mexican immigrants were dismissed as “rapists”, bringing nothing but drugs and crime to the US. Within minutes it was clear this would be a shockingly divisive campaign.

But it was a weapon he would wield effectively against Republican opponents. Bush was taunted as “low energy” during a series of debates that played to Trump’s strengths as a TV performer but brought the Grand Old Party down to the level of a schoolyard bully.

By the time New Jersey governor Chris Christie joined in by destroying another promising rival, Marco Rubio, it was clear Trump had re-created the brutal dynamic of his reality TV franchise, The Apprentice. Like many bullies, he also showed the thin skin – and small hands – that Clinton would later learn how to exploit in their own debates.

She showed early poise, too, in her debates against Sanders, helped by his determination to focus on their many policy disagreements. “The American people are sick of hearing about your damn emails,” he conceded, rescuing his opponent from an early controversy over a private email server she had used while working as secretary of state.

It was an issue that was to come back to haunt her again. Though many Democrats agreed with Sanders, the email controversy raised worrying questions about Clinton’s penchant for privacy. Why should she evade rules designed to ensure classified information remained safely stored on government computers – measures that meant embarrassing transgressions might be subject to freedom of information requests? Meanwhile Republicans asked: what did she have to hide?

Making up after a rough Democratic primary season. Photograph: Cj Gunther/EPA

Sanders would not avoid digital controversy either. When staff members were caught looking at Clinton campaign tactics on a shared electoral database, he turned the matter instead into a fight over whether the Democratic National Committee was tipping the scales against him by exacting disproportionate punishment. What sounded paranoid at the time would prove an understatement.

Clinton, on the other hand, stuck to a simple message. Hers was, without doubt, one of the most qualified candidacies of modern times. Lawyer, first lady, US senator, presidential candidate, secretary of state: it was a résumé none of the 17 original Republican hopefuls could match.

While Sanders and Trump focused on America’s economic divide, Clinton spoke of its social unity. “Stronger Together” was a campaign slogan that sounded empty at first, but more and more powerful as her Republican opponent sought to rip civil society apart.

There are many “what if” scenarios to ponder. What if vice-president Joe Biden had not been derailed by the death of his son Beau and had decided to run as a populist with experience? What if Sanders had given a damn about those emails? What if either Trump or Clinton had been up against a candidate with more natural charisma – a regular politician?

But early encounters with voters in 2016 quickly made clear this was anything but a regular election.

A tumultuous primary season

In Iowa, traditionally the first state to pick nominees, the caucuses proved the biggest shock to Democrats. Sanders was to lose to Clinton by a whisker, providing an early indication of her difficulties with white working-class voters.

Trump got off to a slow start in Iowa thanks to the evangelical appeal of Texas senator Ted Cruz, but by the time the Republicans got to the next vote, in New Hampshire in February, the anti-establishment revolt was in full swing. Sanders and Trump were to win there by record landslides that continued to worry the Clinton campaign up until the general election.

Super Tuesday on 1 March provided much stronger territory for Clinton, who took an ultimately unassailable lead over Sanders by cleaning up across the south. She and Trump won seven states each that night, and the nomination race looked over for each party.

There were still surprises to come, some with further potential bearing on Clinton’s vulnerabilities in a general election. Michigan was the biggest shock, pointing to the anger in the industrial midwest over trade policy. Wisconsin and Colorado were other states where Sanders would continue to raise the hopes of his supporters and the eye of Republican strategists come November.

But Clinton also demonstrated her strength in diverse, prosperous, metropolitan America. Her wins in New York and California finally extinguished the Bern and showed the power of the multi-racial coalition built up by Democrats. Neither Green party candidate Jill Stein nor libertarian Gary Johnson would gain much traction against such a polarising pair of candidates in the months of bitter slogging that followed the primaries.

When things looked bleakest for Trump, he would turn abroad for inspiration. He visited Britain the day after it voted to leave Europe to align himself with the mood of rebellion and invited UK Independence party leader Nigel Farage to campaign with him in Mississippi. He would travel to Mexico to try to prove statesmanship, and developed a bizarre affinity with Vladimir Putin that would lead some to suspect Republicans had nominated a modern-day Manchurian candidate.

Trump’s authoritarian streak was most visible during the Orwellian-sounding Republican convention in Cleveland where he proclaimed himself the “law and order candidate”. His wife Melania brought ridicule to the ominous proceedings by plagiarising a speech of Michelle Obama’s, while Cruz, who did not endorse Trump in his speech, revealed just how deep the rift had become with mainstream Republicans.

Clinton had the finest hours of her campaign in Philadelphia a week later, basking in the spotlight as the party’s first female nominee and sharing the glow of stellar speakers such as the real Michelle Obama and their two husbands.

The party’s two chosen running mates – Mike Pence and Tim Kaine – receded far into the distance in the face of such larger-than-life personalities. Only their vice-presidential debate was to provide a rare moment of normality during a trio of menacing encounters between Trump and Clinton.

Despite accusations that TV networks had given Trump too much unquestioning airtime, newspapers showed their investigative mettle. The New York Times convincingly demonstrated how little tax Trump had paid in the 90s, and the Washington Post unearthed the infamous recording of him bragging of grabbing women by their genitals. The Guardian revealed that these were not just hollow boasts, interviewing the first alleged victim who claimed he had done just that and foreshadowing a string of damaging sexual assault allegations. Internal Democratic campaign emails obtained by WikiLeaks also created both heat and light, but the website was accused of aiding and abetting a Russian hacking operation.

Yet it was the FBI that was to play the most controversial role, revealing at the 11th hour the existence of further Clinton emails found on the laptop of the disgraced husband of her confidante Huma Abedin. Some say the bureau was stung into action after allegations that Bill Clinton had sought to interfere in earlier investigations by meeting with US attorney general Loretta Lynch. Others, including Obama, accused it of improper leaks. Insiders revealed a culture of distrust for Clinton in a conservative-leaning organisation one told the Guardian was akin to “Trumplandia”. Just over a week later, FBI director James Comey told congressional leaders the new emails “have not changed our conclusion” that she committed no criminal wrongdoing.

None of it compared with the shocking revelations that clouded Trump throughout. Some even wondered if he was going out of his way to sabotage a campaign that had only ever been intended to promote his business interests. But as he headed into the final days of the campaign almost drawing level with Clinton in the polls again, many Democrats worried whether the electorate had grown numbed to his outbursts. They have had to wait until election day to discover whether voters would reject the bombastic populism and embrace a Madam President, or opt to make history in another way.