McCain lost for two reasons.
1. He ran a poor campaign. He preferred to suffer an “honorable defeat” rather than conduct a campaign that would be out of character. He was very afraid of the race issue and refused to call Obama a socialist even though he was a member of the radical "New Party" in Chicago in the 1990's. He was afraid socialist would be equated with black(example here.) He refused to use Obama's association with the radical black liberation preacher Reverend Wright; even though others tried. Also, He was afraid to fully unleash Palin. John McCain took matching federal campaign money and gave Barack Hussein Obama a huge financial advantage.
2. The MSM(Main Stream Media) had Obama's back. The MSM spent more time trying to learn about the guy that "knocked Pailin's daughter up" than they did trying to learn about Barack Hussein Obama's relationship with convicted terriost Bill Ayres.. The media coverage of McCain was very negative. Nearly six in ten of the stories studied were decidedly negative in nature (57%), while fewer than two in ten (14%) were positive according to the study by the Pew Research Center’s Project for Excellence in Journalism. The coverage of Sarah Palin was even worse. According to a Nexis search, the networks ran 69 news segments covering Palin between September 29 and October 12, a period that included the October 2 vice-presidential debate. CMI analyzed all 69 segments and found that 37 portrayed Palin negatively, only two were positive, and 30 were neutral.