McCain lost because the economy went in the tank. Simple as that. But having said that, his campaign was still in most respects bad.
I wish it was that simple. I firmly believe that if McCain, or at least someone he would listen to, had any clue on the economy they could have buried Obama. If McCain had come out and said the problems with the economy were all the governments fault he could have forced Obama to defend voting for Bush's 'stimulus package'.
Unfortunately, all McCain could manage was his weak and infuriating "Wall Street Greed" line.