Donald Trump had spent most of election night in his penthouse at Trump Tower while his team waited in a room on a floor below, which had become so messy during the final days of the campaign, it was known as the “crack den”.

Nobody knows the precise moment when he realized he would be president, but once it was clear he had pulled off a shock win in the 2016 election, his family, friends and aides were not sure how to congratulate a man who was about to take elected office for the first time.

So instead of congratulating Trump directly, most people high-fived and saluted “Mr Vice-President” Mike Pence, according to a detailed new account of the night that transformed the United States.

The journalist Joshua Green’s new book, Devil’s Bargain: Steve Bannon, Donald Trump and the Storming of the Presidency, opens with election night in Trump Tower before diving into revelations about the political strategist Steve Bannon’s influence on the president.

The campaign’s own internal polls tilted in favor of Trump’s election rival, Hillary Clinton, for months ahead of election day.

Bannon himself conveyed doubts to an aide after the infamous Access Hollywood tape was released that captured Trump saying in 2005 that he could use his fame to grope women without waiting for their consent.

But those predictions tumbled on the night of 8 November 2016, and surrounded by allies on the 14th floor campaign war room, Trump responded to the news with a “hidden forcefield around him that discouraged a direct approach”, Green wrote.

When Trump finally came down to the 14th floor’s campaign war room, he responded to every county election result by asking: “How did Obama do there in 2012?”

This is not entirely surprising, as Barack Obama provided a foundation for Trump and Bannon’s relationship, the book explains.

Green draws a line between Bannon and other noted political operatives, such as Karl Rove, but said what Bannon succeeded at was finding a vessel to deliver his “populist-nationalist ideas” and building a system for the far right to thrive in.

Bannon was not set on Trump being that vessel and had met with Ted Cruz, Rand Paul and Ben Carson ahead of the 2016 election.

But in Bannon’s eyes, Trump distinguished himself when he challenged whether Obama was a citizen.

Trump promoted the so-called “birther” conspiracy movement and saw that prominent Republicans would not strongly condemn his accusations. The businessman guessed that if he were to pursue the presidency, they probably wouldn’t strongly condemn his behavior either, even if they were privately disgusted by it.

“Trump was plumbing the depths of latent racist hostility toward the president and discovering that there was a lot of it there,” Green writes. “Everybody in politics knew this sentiment existed, but the longstanding consensus had been that it should be kept out of the public arena”.

In came Bannon, whom Trump relied on from the early days of the campaign.

At conservative conferences, Bannon was always by Trump’s side. The relationship was so deep, recalled Sam Nunber, an ex-Trump aide, that at the Freedom Summit Trump went around and said: “Where’s my Steve? Where’s my Steve?”

Bannon also supported the not-yet-president when establishment Republicans searched for an alternative as it became clear Trump was close to becoming the Republican nominee in spring 2016. Paul Ryan, who is now the House Speaker, was floated as an alternative candidate.

Bannon referred to Ryan at the time as “a limp-dick motherfucker who was born in a petri dish at the Heritage Foundation,” referencing the conservative think tank.

The relationship between the White House and Ryan remains strained.

On election night, Bannon was by Trump’s side again and remained close to him while some people’s behavior that night saw them pushed out of Trump’s inner circle.

As people congratulated Pence, unsure whether they could approach Trump, the New Jersey governor, Chris Christie, sat beside Trump and told him he could expect a call from Obama soon, on Christie’s phone. Trump “clearly” resented the intrusion and as a “fanatical germophobe” would not want to press Christie’s phone to his face, Green wrote.

Later, Christie stormed into an intimate celebratory gathering in Trump’s penthouse, behavior that is said to have led directly to him being pushed out of Trump’s inner circle. “Trump hates being smothered, and Christie just got under his skin,” a source told Green.

After the night’s festivities – which included a brief call from Clinton, which Bannon described as “very classy” – Sean Spicer, now the White House press secretary, responded to Trump’s win by walking around Manhattan alone, attempting to process the shock.