A book about the dimly remembered past was published last week. No, not the second volume of Charles Moore’s authorised biography of Margaret Thatcher. That was the week before. Last week’s book was Tim Ross’s Why the Tories Won: The Inside Story of the 2015 Election. It tells the remarkable tale of a land of hung parliaments, television debates, and people who thought Ed Miliband as prime minister was a serious possibility. How long ago it seems.

But it is worth revisiting the ancient history of six months ago because, whatever is going on in the Labour and Liberal Democrat parties now, the question of how to win elections is terribly important. This book is brilliantly clear about how it was done and who did it. The answers are: empirically and Lynton Crosby.

If you can cast your mind that far back, you might remember thinking that the Tory campaign was dull and uninspiring. Actually, Crosby, the Australian consultant who ran it, was one of the few people who knew what he was doing. He was one of the few who never wavered in his conviction that the Tories were going to win. He told me in March: “I can see 23 seats we can win. We’re on 303 at the moment.” That was the objective, to win a bare majority. His campaign delivered 331 seats, exceeding the target by five.

Crosby has a reputation as a rather thuggish right-winger. He ran Michael Howard’s unsuccessful 2005 campaign, which some liberal journalists didn’t like for the slogan, “It’s not racist to impose limits on immigration”. But it was a competent campaign that gained ground.

Ross’s book goes some way to rehabilitate Crosby’s image. He is portrayed as a demanding but popular boss who inspired great loyalty from his team. He would praise staff for outstanding effort and award them soft toy koalas or kangaroos. Occasionally, he would relieve tension by playing “One Vision” by Queen at full volume from his computer speakers in the election war room. What the book leaves out is that he is one of only three people I know who has been to the Sing-a-long-a Sound of Music (more than once, in his case), and who has been on the Sound of Music tour of Salzburg. So he can’t be all bad.

The joking around and clear lines of responsibility – Crosby was in charge with David Cameron’s full authority – were important in building a united team. He and Cameron had both learned from the confusion of the 2010 campaign (in which Crosby was not involved). Just as important, though, was Crosby’s focus on evidence and information.

His opinion polling, carried out by his business partner Mark Textor, was better than the public polling carried out for media organisations. It was also better than the constituency polls carried out by the disaffected Tory Lord Ashcroft, which mostly showed the same thing as the national polls. Textor seems to have picked up the differential turnout that skewed the published polls.

The research prompted Crosby to target Lib Dem MPs who, according to conventional wisdom, would benefit from an incumbency effect. It led to a focus on direct mail, Facebook and email rather than on Twitter and YouTube. Labour thought they had more people knocking on doors, but Ross reports that the Tories didn’t contradict them because they knew their efforts were better targeted.

Early on, I am told, the research told Crosby that the SNP vote was solid – Scottish voters were the least likely to change their minds – and that this would have implications for Labour’s chances of being the largest party, as well as for the campaign message. The prospect of Miliband needing SNP co-operation to form a government proved decisive by the end of the campaign.

Ross also recounts Miliband’s reluctant acceptance that people didn’t think he could run the economy, and his attempts to do something about it. One was like an old banger on four piles of bricks when the traffic lights changed, as Miliband forgot the section about the deficit in his conference speech in 2014. The other big one was a paragraph on the cover of the Labour manifesto setting out a “Budget Responsibility Lock”, which was too late to change perceptions that had calcified like limestone.

It was Crosby’s attention to campaign mechanics that turned political advantage into votes and seats. The first meeting of the day was at 5.45am. By 7.30am he was on his third, with Cameron and George Osborne. The Labour team did not meet until 7.45am, because Miliband was not much of “a morning person”, Ross reports a Labour insider as saying.