In 2004, I don't know how John Kerry did so well and got 251 electoral votes. He was very close to becoming President!
And in 2012, Romney was tied with Obama with the polls at the very end, when they're tied in the polls at the very end, the Republican usually wins.
1. Bush did not run a good campaign, truthfully he didn't deserve to win that year, just 150,000 votes different would've made the difference [whether by Ohio, or over the cascade of New Mexico, Colorado, Nevada, and Iowa].
2. Romney was never tied in the state polls of the swing states, the one place he was ahead was North Carolina...and iirc, Obama abandoned efforts there.