McCain did something very silly in the election, something which destroyed any chances he might have had left. Vice-president Palin! So, why her, of all people?
Well, they had a problem. A section of Obama's support base voted for him not particularly because they believed in his policies, or even understood them (that many people took McCain's 'socialist' charge seriously shows that a significant section of the American population really has no idea about what is involved in running a country at all), but rather because they wanted to be part of a historic election, the first election in which a black person was elected.
Of course, McCain couldn't nominate a black person himself; a large part of the Republican support base is made up of racist dolts. One need only look at what happened to Democratic support in the southern states after the end of America's apartheid. Nor a Jew, because, well, there are a surprising number of those crazies who go on about Jewish conspiracies out there, and they almost all vote Republican. Romney might have been an option except that, well, he didn't feel different. He went out of his way to downplay the Mormon thing throughout his campaign.
McCain, as well, did not appeal to the Jesus-freak segment, who are also big Republican voters.
So, there were two constraints; the VP candidate had to be a woman, all minorities being deemed unacceptable, and she had to be a wacky religious person. But there was really a third constraint. A lot of Republicans, even female Republicans, are very, very paranoid about 'feminists'. Quite what they think feminists are is unclear; certainly nothing to do with the normal definition. But they don't like them, and thus a competent, successful woman would seem a threat. Some were considered at one point, apparently both the EBay CEO and Carly, the Killer of Alphas, were considered. But ultimately, they could have frightened some of the voters.
So, instead, they got the dim, crazy governor of Alaska. On paper, she seemed okay. Weird religious views and affiliation with a scary anti-Semitic group, total bemusement about the world around her, and a history of massive abuse of power for personal ends. There was, however, a hitch. McCain's campaign had special circumstances; while normally the VP isn't that important, and there is only a vague chance of them becoming president, in this case, it was practically certain that McCain would die, if not in his first term then in his second. I don't think anyone, not even the dumbest, most bigoted, fag hating cross burning bible thumper, could quite imagine President Palin. The image was just too disturbing. Meeting with leaders of countries she'd never heard of, dictating finance, when, let's face it, she probably doesn't know what complex interest is, behaving in the interest of her country when she couldn't even put the interests of her state over her personal neuroses... It couldn't have worked.
And that, to a large extent, is why McCain failed. He was caught in an impossible position; there was really nothing he could have done to make it right. Thankfully. Imagine four or eight years more of the Republicans. Not that I'm convinced Obama will be all that much better, but he could hardly be worse.