It got lost with history, understandably given the landslide it turned out to be, but McCain was a very strong candidate and was perhaps the best GOP nominee since Eisenhower. He had very good favorability numbers with independents. If you go back to 2000, he was blowing Gore out to a crazy degree in hypothetical polling. It's kind of a miracle that he won a GOP primary given how out-of-step with the base he was.
Unfortunately for him, he was running against a generational political talent and was saddled first with defending an extremely unpopular administration and then a collapsing economy. Before the economic crash he was keeping it competitive, with a result more akin to 2012.
This. McCain was a very strong candidate, just in a horrendously bad year for his party and against an equally strong opponent.
I recall reading that McCain led in Florida (still the quintessential swing state in the 2000s, of course) for much of the campaign, right until the Lehman Brothers debacle when the economy really took a turn for the worse.