I think McCain did want to win. He was on a political dead watch in August 2007. He had no money and no staff. His allies told him to quit the race and get behind Giuliani. Yet he refused. Then Fred, Mitt, Rudy, and Huckabee all imploded and McCain was the last man standing.
However after seeing the money Hillary and esp. Obama were raking in, the McCain campaign became demoralized. McCain wandered the country aimlessly looking for campaign theme. Mac finally found a campaign them in Palin. Mac wanted to talk about national security and Palin was to discuss energy independence. Then the stock market cash came and those issues were knocked off the table. As result, Mac became unfocused and tried to shift focus away from the economy. Doing so made McCain look out of touch with the American people. That sealed the deal for Obama.
Consider, 1. James Simpson's "Crisis of Manufactured Crisis" articles and, 2. McCain shooting his chances in the foot by taking the wrong side on the bailout.
I think the whole thing was a rope-a-dope. The media were happy to have him as the nominee since they knew he wouldn’t attack the Democrats and would play the role of graceful loser. He only deviated from the script for 5 minutes when he chose Palin. The media took care of that by destroying Palin and her family. He then went back to the script. Naah, he didn’t want to win.