Obama was supposed to be the racial candidate. He has the Kenyan father. He spent all of those years in an "Afrocentric" Chicago church. He was the student celebrated for being the first "Black" editor of Harvard's Law Review, a first that served to push him onto the national stage even before he finished law school. (The contract for his memoir came as a function of this singular accomplishment at Harvard.)
But McCain lost this election because he was able to turn himself into the racial candidate.
Many analysts have written about the so-called "browning of the America," the relative shrinking of this country's white population as a function of demographic shifts linked to immigration and differential birth rates among racial/ethnic groups.
Obama ran his "post-racial" campaign with full appreciation of how such demographic shifts have also changed the makeup of the electorate. He registered more people of color, and he made sure that they got to the polls. He told them that this was their America, too. Obama was careful not to overemphasize race in his public speeches and media interviews, but his campaign mobilized America's multi-racial realities (in terms of its highly praised "ground game") to catapult the Chicago senator into office.
In contrast, every decision McCain seemed to make this campaign season reflected a profound under-appreciation of America's diverse body politic, a denial of it, or even something bordering on nostalgia for myths about American racial homogeneity.
For instance, he chose a charismatic vice presidential running mate who did nothing to demonstrate any explicit recognition of America's changing ethno-racial composition. She did a fantastic job energizing "the base." But for those who didn't already unequivocally consider themselves to be part of that Republican base, she also gave the (false?) impression that the base was constituted by the intransigent sameness of race, by a euphemized whiteness.
Even the campaign's late-game deployment of "Joe the Plumber" seemed to traffic in the same denials about America's changing demographic makeup. Joe the Plumber was supposed to stand in for average Americans, but he probably just ended up further alienating many of the new black and brown voters who saw his support of McCain (and his discussion of Obama's "socialism") as another attempt to play a white version of "the race card" without explicitly invoking race at all.
This isn't to say that McCain should have pandered to black and brown voters by finding a Mexican version of Joe. But he was silently making a statement (whether he wanted to or not) about his definition of America by trucking Joe out as his quintessential example of the everyday American. It was a definition that came off as decidedly less inclusive and eclectic than Obama's. And that was the beginning of the end for McCain. He relegated himself to being "the white candidate" even as Obama tried to transcend his designation as simply the black one.