McCain lost the election because he is unable to formulate solutions in a complex environment. This came out time and time again during the campaign, and is the motivating factor behind the issues that people claimed as their reasons for voting Obama: economy and the war in Iraq.
McCain is extremely good at taking a principled stand on issues where there is a clear right and wrong position. His heroism in Vietnam is the clearest indication of this. Another good example is the work on campaign finance reform that bears his name, and has led to those disclosures at the end of political ads ("I'm so-and-so and I approved this message.").
However, McCain simply ceases to function effectively when the decision environment becomes complex. Take, for example, the economy and the Iraq war.
On the economy, McCain "suspended" his campaign, traveled to Washington where by most accounts he slowed and distracted the process, and yielded a plan that his own party shot down. He clearly has little grip of the issues that contributed to our current fiasco and even fewer concrete ideas about how to get us out of this mess. It probably doesn't help that the current downturn has virtually no meaningful implications for his personal financial status.
On the Iraq war, McCain needs to turn a complex situation into a bite-sized nugget in order to formulate a solution. The situation in Iraq is a combination of ethnic strife and religious intolerance superimposed on an area that has never regained a post-colonial identity. (Notice all the straight lines on maps of the Middle East; these were drawn in European capitals.) The United States will never successfully impose a solution on Iraq; hopefully we can mediate and facillitate a peaceful arrangement that maximizes communication and participation. Unfortunately, the only way McCain can express his position on this complex situation is through the language of victory, World War Two-style. His language ("we will never stop fighting until we achieve victory!") recalls the era of confetti parades and sailors kissing girls in the streets. But McCain is not able to articulate a solution beyond the fight-victory imagery that actually identifies or addresses any of the actual problems in Iraq.
When we hear that Obama was the right candidate for the times, this is what it means for McCain: his inability to grasp complexity and formulate appropriate solutions meant that he ceded all intellectual momentum to Obama. This explains, at least in part, why McCain's campaign during the last weeks of the election was only about Obama -- what Obama said, what Obama stood for, and ultimately why Obama won.