Honestly, I don't think she was a bad choice. I know this sounds ridiculous in hindsight.
At the time, she was one of the most popular governors in the US. She was young (44), female and in charge of the largest state in the country by landmass. She was a rising star in the Republican party and on the short list for the next opening for the US Senate.
She was also a Westerner like McCain, at a time where the Republican party wanted to make sure it didn't become the party of just the Southern US and voters were sick and tired of the Bush administration and the career Republicans running the place.
McCain was losing, and losing momentum. People were scared, companies were going bankrupt, and the stock market crash was imminent.
His top choice was Lieberman, but he couldn't choose him. Republicans would hate to see one of the Senate's most senior Democrats (who was pro-choice) as VP. Many Democrats really disliked him too for his support for the Iraq War and opposition to Obama. He lost his primary seat in 2006 and ran as an Independent against the Democrat, basically winning by consolidating the Connecticut Republican vote.
The others on the short list were Governor Pawlenty (MN), Governor Jindal (LA), Governor Romney (MA) and Former Governor Ridge (PA). All governors. Pawlenty and Romney were the safe choices, but I don't think they would've been able to turn the tide and shift attention away from the Obama campaign.
I was a strong supporter of Obama, and I remember getting worried when McCain chose her. I was really disappointed to hear her first speech - it was patronizing and vindictive, but red meat to the Republican base. I think she basically was told what she needed to do -- i.e. serve as the attack dog and rile up the Republican base and fuel get out the vote efforts in those last two months. And she did a pretty good job at it. She did fine in the VP debate, though Biden did as well, and she looked very comfortable on the national stage.
I think the Democrats ran a great campaign, and were able to define her as a political neophyte that was unqualified to serve as President. I also think that McCain personally wanted to run an ethical campaign focusing on the issues, and her full embrace of the red meat partisan issues undermined his campaign. But if he had chosen someone else I don't think there would've been a different outcome. Republican strategists would still have come up with 'death panels' and trying to tie Obama to Bill Ayers and all that other conspiratorial nonsense, it just would've been a different politician saying it.