Two main scenarios emerge here. One, that McCain himself did not intend to win. Two, McCain had turncoat staffers who sabotaged the campaign. These are not necessarily mutually exclusive. McCain may have hired these people knowing what they would do.
But a third scenario could be considered. First, consider what an egomaniac McCain appears to be. Second, consider how weak his campaign was until Sarah was picked. Third, remember how much unbelievable excitement Sarah injected into his campaign.
Theory: McCain would rather have lost the campaign than allow the credit for the win to go to Sarah, because he couldn’t take the hit to his ego. Just sayin’.
This is my theory, but I think that McCain wanted to win...but not all that much, basically, and he was more interested in being nice and civil than in doing what had to be done. Look at all the times Repubs were being lovey dovey milquetoasts while the Left were a bunch of ruthless Machivellians.