Mcain's primary win was a rebuke of Bush. McCain lost to Bush in the 2000 primary. He ran again in 08 and that time he got it because he represented a different "maverick" path from Bush's Neoconservatism.
McCain was also a neoconservative, but his brand was a straight shooting veteran with principles.
But the voting base wanted more change than that. McCain was still a Republican. The people wanted the Opposite of Bush, as seen in the down ballot races giving Dems a supermajority. People were predicting the end of the Republican party in 2009.
We all know how that turned out. But at the time it seemed transformational.
It was a terrible decision, but only in hindsight. She was a popular governor and a political outsider, even by Alaska standards.
But she let the proto tea party get to her and just ran with her worst instincts.