With all due respect the main reason Obama won was John McCain.
I did not say “predominately”, only “not at the least”.
I agree, of course, that McCain was a weak candidate.
Another reason was Bush not acting like a conservative and losing the base (fill in the long list of his not-conservative actions).
And another was republicans in congress forgetting about fiscal responsibility - a very substantial part of the apolitical middle voted GOP for years only because of fiscal issues. They lost the reason to prefer GOP and went with the hype of the historical first black president.
I don’t list the country being tired from the long war because this sentiment was born and carried by the non-stop drumbeat of the anti-Bush media.
So, there were many reasons, and media played its very significant role.