Depending which opinion poll you believe, this election looks like being closer than the pundits expected. Blairites' belief that Corbyn was “unelectable”, and May’s idea that she could win a landslide without even turning up now look doubtful. Yes, they might be correct, but the confidence interval around those views now seems wider than it did a few weeks ago. (These people don’t often deal in confidence intervals, but let that pass).

This raises the question: why have his critics under-estimated Corbyn? (We might add to this list those Labour MPs who put him on the leadership ballot in 2015 believing he couldn’t win).

I suspect there are two cognitive biases to blame. One is deformation professionnelle – the tendency among all professionals to see things from the perspective of their own occupation. People inside the Westminster Bubble over-estimate the importance of playing by their own rules. They’ve thought that you win elections by occupying a perhaps mythical “centre ground”; by kowtowing to deficit fetishists and immigration-phobics; and by satisfying a managerialist conception of credibility. What this might have under-estimated is the popularity of: halfway sensible policies, a focus upon justice and living standards; and at least the appearance of basic humanity.

Another bias is the halo effect – the tendency to believe that someone with a few good qualities somehow possesses all virtues. In bad Hollywood movies, the villain isn’t just morally inferior to the hero but is also uglier and a worse shot. By this same reasoning, Corbyn’s faults such as poor management and terrorist associations led pundits to under-estimate his strengths such as personability and skill at campaigning and debating: his critics love to point out that Corbyn hasn’t changed his views for 30 years, but overlook the fact that this gives him the advantage of knowing his lines well.

It is of course trivially true that nobody’s perfect (a cliché proven by the fact that Rachel Riley supports Manyoo) and few of us are entirely imperfect. What’s not so much appreciated though is that success and failure is often not a case of people being good or bad. Instead, success results from circumstances favouring our virtues, whilst failure happens when they highlight our vices. A successful hiring decision isn’t so much one that finds the best person for the job as one that finds the right match. To take an example from Boris Groysberg (pdf), two managers might be of equal overall quality but if the firm is looking to increase market share, the good marketing man will be a better hire than the good cost-cutter.

Sometimes, of course, circumstances will change so that the same man will be both a failure and a success at different times: Steve Jobs’ difficult personality both got him sacked from Apple and drove the company to huge success; and Winston Churchill’s bellicosity made him a lousy peacetime politician but a great war leader.

Which brings me to one of several questions that is curiously neglected in this election campaign. Insofar as leadership is an issue, the question shouldn’t be: who’s the best leader, but rather: do circumstances favour Corbyn’s mix of strengths and weaknesses or May’s? Idle blather about leadership is not enough: we must instead ask about the precise technology whereby leaders affect outcomes.