If Jennifer Palmieri could turn back the clock, and make one change to Hillary Clinton’s campaign, what would it be? I can guess any number of answers when I put the question to the campaign’s communications director, but not the one she gives.

“I would have spent more time and money,” she replies without hesitation, “in Texas, Arizona and Georgia.”

Palmieri’s explanation makes perfect sense. She says they made the classic mistake of devoting their energy to the swing states of previous elections, such as Ohio, while overlooking historically safe Republican states now becoming winnable due to shifting demographics. It’s a clever answer – analytic, pragmatic, strategic; everything, in other words, we associate the Clinton campaign. What also makes it quintessentially – perhaps calamitously – Clintonesque, however, is its failure to strike any kind of emotional chord.

Palmieri was 24 when she first worked in the White House, for Bill Clinton. Under Barack Obama she became director of communications and in 2015 she joined Hillary’s campaign team. The 51-year-old has dedicated her life to the Democrats and, had about 80,000 Americans voted differently in November 2016, she would now be in the White House again. Instead, Palmieri is in London, promoting her book about what went wrong.

There is nothing colourless or dry about Dear Madam President. In person, its author is forthright, quick-witted and doesn’t mince her words. She describes Donald Trump as a dangerous, unstable, racist misogynist, looks on the verge of tears at times, and can be very funny. “It was like the Batman movie version of a presidential campaign,” she jokes at one point. “Both candidates are from Gotham. You have all these side characters, like the Russians and Julian Assange, the creepiest man on the planet. Obama was Commissioner Gordon. And Jim Comey was like Catwoman; sometimes Catwoman’s on your side – and sometimes she isn’t.” Had we met on the campaign trail, however, I don’t think I would have found her company as entertaining. Her overall demeanour suggests a battle-scarred soldier returning from a brutal defeat, from which she is yet to recover.

‘The morning we lost the election was like that movie you never see where they don’t defuse the bomb in time’ … Palmieri with Clinton at a rally in 2016. Photograph: Andrew Harnik/AP

When Palmieri woke up on 9 November 2016, she says, “It felt like the movie scene that you never see. Where you don’t defuse the bomb in time, and the world actually explodes.” Right up until 19 December that year, when the president was formally elected by the electoral college: “I held out hope that we would fight on. I thought there was a chance the Republicans would stop it.” She allows a bleak smile. “I thought maybe they would make Paul Ryan president.” Were her hopes just the desperate delusions of denial? “No, I think there was a chance that something different could have happened. Everyone said, ‘But that’s crazy.’ I said: ‘Well, the alternative is Donald Trump is actually going to be president of the United States. So how does that sound for crazy?’”

But now he is, and Palmieri has given a lot of thought to why. When she joined Clinton’s team, she didn’t imagine gender would play much of a part in the campaign. “I didn’t think it mattered that [she] was a woman,” she writes in the book. “I just thought she was the best person for the job.” She now believes Clinton lost, ultimately, because America wasn’t ready to elect a woman to the White House.

When Clinton first sought the Democratic nomination in 2008, she says, “The question was, can a woman be commander-in-chief? But by 2016 she had been secretary of state; the problem wasn’t, can a woman do the job? The problem was: why does she want it?” The campaign team’s polling research bore this out. Whereas male leaders are at their most popular when campaigning, for female politicians, the reverse is almost invariably true; they come to be admired only in office. It wasn’t that Clinton was a poor candidate, in other words, but that voters were alienated by the fact of a woman seeking power. “Her most popular attribute,” points out Palmieri, “was being secretary of state, because she had been willing to work for the man who defeated her. And everybody loved her concession speech, because that’s what they like women doing: losing graciously.” But on the campaign trail, all Palmieri kept hearing people say was what she dubbed TSAHIJDL: “There’s something about her I just don’t like.” That “something”, Palmieri came to conclude, was female ambition for power.

She doesn’t believe everyone who voted for Trump did so because they were sexist. She is, however, convinced they were swayed by the unfamiliarity of a female presidential candidate. “I would get memos from big-deal people in Hollywood, giving their advice about what she had to do, and I would think there must be something wrong with me, because I couldn’t work out how to implement their advice. Then I realised it just did not make any sense. ‘She’s got to show strength at all times – and also show us her vulnerable side.’ You’re like, what?” When the advice was relayed to Clinton, she would say to Palmieri: “Tell them, ‘That’s super helpful, thank you so much. You know what else would be really helpful? Show us a woman on the world stage who does this just right, and then Hillary can copy her.’” Could anyone name a single woman who has pulled off the trick of appearing simultaneously presidential and feminine? “‘Angela Merkel,’ they would say,” grins Palmieri. They would then think for a moment, and admit to her: “Er, maybe not.”

‘I couldn’t let her go through that hell again’ … Palmieri with Clinton on the campaign trail days before the election. Photograph: The Washington Post/Getty Images

Dear Madam President offers us a brilliant analysis of the challenges Clinton’s gender presented, from the “pink tax” levied on a female candidate’s time – crafting hair, makeup and clothing to look both attractive and authoritative, which took up a good hour of every day – to the conundrum of how to pitch her voice to address mass rallies without sounding shrill. Women didn’t even have the vote until the year Clinton’s own mother was born, Palmieri points out, and in the absence of earlier role models: “We reduced Hillary to a female facsimile of all the qualities we look for in a male president. So no wonder people thought she was inauthentic. It wasn’t as if we said: ‘Hey, here’s a great idea, let’s turn her in to a man.’ We just didn’t have any other model.”

It’s a compelling argument – but arguably also convenient, exonerating the author by putting all the blame for defeat on her candidate’s gender. “I don’t care what people think,” she says, suddenly testy. “Trump supporters say to me all the time: ‘Oh now you have a new reason why you lost.’ It’s like: ‘Why do you care? Just be happy that Trump won. Why do you even care what I’m doing? Why can’t you just be happy that your candidate won?’”

Palmieri claims to feel no anger towards the winning side – “It’s just not how I’m built” – but I’m not convinced. She refuses to follow Trump on Twitter: “I won’t give him the satisfaction of an extra follow.” And when I ask if it felt as if she had been fighting an electoral genius, snaps: “No, I refuse to believe that that guy is a genius. I have never believed, and refuse to believe, that there’s a big genius strategy behind him.” She suspects Moscow’s influence in the election extended as far as hacking into polling stations. “People tell me that it is not technologically possible, but I don’t know, I’m not convinced. I’m still uneasy about it.”

Palmieri was director of communications under Barack Obama. Photograph: REX/Shutterstock

If she sounds angry, it is because she’s abandoning the caution of a campaign mentality that endlessly tried to second-guess public opinion, she says. “It’s probably how we got into this situation, by people like me thinking that you can control how the public is going to react to one thing or another, and you can’t do that and it’s dangerous to try.” This is why, when I ask how the British should receive Trump when he visits, she urges us to take to the streets and protest.

“It is how our closest ally feels, and we should know it. People will say it helps him at home to see Brits protesting. But if we game this stuff out in our heads too much, that’s when voters switch off. That was part of our problem in 2016. I just don’t live my life like that at all any more. We can’t game things any more.”

Palmieri believes that Clinton’s candidacy has transformed American politics for ever. “I really believe that we spent our whole lives following one model, because we thought that the pinnacle of achievement is whatever it is that a white man has done. That’s what success looks like, so we’ve always chased this one model. Now I think, ‘Hey, I don’t actually want that, I want something different. I can’t tell you what it is, but I want something different. And I think the next woman who runs for the White House will have a harder time than she should – but an easier time than Hillary.”

Thanks to Clinton, Palmieri thinks the US is ready to elect a woman as early as 2020. It won’t be Michelle Obama, though. “I can see why it seems like a great idea. We love the idea. But sorry, not happening, not happening. She has no interest in doing that, or running for anything.” Could it conceivably be Clinton? She looks horrified. “Oh no. No, I would do an ankle-dive for that woman before I would let her go through that again. I could not let her go through that hell again.” She shudders. “Terrible, terrible, terrible, terrible.”

The ferociously protective tone crops up almost every time Clinton’s name is mentioned, making me marvel at the contrast between her tenderness, and the public’s hostile distrust. “Well, there’s like this phenomenon, this thing, called ‘Hillary Clinton’ – and then there’s this woman who I think of as Hillary Rodham Clinton, who doesn’t wear a lot of makeup, and wears Coke-bottom glasses, and who we love, who’s a very unique individual, and she just gets lost in all of the turmoil around how people perceive her.” I wonder whether part of the problem was that Palmieri, like other close aides, was just too temperamentally similar to Clinton to grasp how others saw her. She looks annoyed. “The campaign team itself was the most diverse campaign team in campaign history. I don’t think it was a failure of imagination on the part of the staff to see her differently.”

Yet the team seemed incapable of grasping that A-list celebrity endorsements, and Ivy League talk of smashing glass ceilings, didn’t resonate with small-town American voters. How can Palmieri explain why they misread the public mood so disastrously?

“We had a hard time with enthusiasm,” she offers simply. “So when it came our way, my view was: do not step on it. If Beyoncé and Jay-Z are willing to do a concert for you, do it. And if some women are motivated because they want to vote for the first women president, embrace it.”

Palmieri is one of few people on the planet in a position to judge the mood inside the White House now. She knows how daily life in the Oval Office works – so how, I ask, can it be functioning amid the ongoing chaos? She lets out a low chuckle. “Here’s the thing. However chaotic it looks on the outside, it’s always way worse on the inside. The Obama White House, it seemed pretty in-check from the outside, but we were way more chaotic on the inside. So even with Trump, as bad as it looks, the reality in there will be even worse.”

How bad does she think it could get? Palmieri’s answer would suggest she has given this question a great deal of thought.

“I think there’s a 62% chance that America comes out of this stronger. And a 38% chance that America descends into a fiery pit of racial hatred.”

Dear Madam President by Jennifer Palmieri is out now (Hodder & Stoughton, £12.99). To order a copy for £11.04 (RRP £12.99) go to bookshop.theguardian.com or call 0330 333 6846. Free UK p&p over £10, online orders only. Phone orders min p&p of £1.99. To order a copy for £11.04 (RRP £12.99), go to bookshop.theguardian.com or call 0330 333 6846.