It is not possible to know with certainty exactly what factor was decisive in the 2008 presidential election. We cannot know for certain why people voted the way they did or why they decided to vote or not to vote. We can only make inferences and hope that they are accurate. In addition, people can make different arguments about which of many relevant factors was actually the decisive factor. I would suggest that you consult your book or your notes in case there is a factor that your instructor expects to see in your answer to this question.
One factor was the Democrats’ advantage in the “ground game” of the campaign. Political pundits use the term “ground game” to refer to a campaign’s efforts to make sure that people who support their candidate get out and vote. Campaigns have to identify people who are likely to support them, contact those people and ask for their support, and follow through to make sure those people actually go and vote. All of this takes a lot of money and a lot of labor. The Democrats were much better at organizing their ground game and using technology in that “game.” This was a major factor in helping Obama win.
A second factor was Obama’s own skill as a candidate. In 2008, he was able to portray himself as a beacon for Americans who hoped that their country would be able to turn itself around and head in the right direction. In his speeches and in his general demeanor, he was able to convince Americans that he could bring them hope. This was in contrast to his opponent, John McCain, who was much less charismatic.
While these factors were important, I would argue that the decisive factor was public unhappiness with the state of the country in 2008. By this time, many Americans were very unhappy with the war in Iraq. They were unhappy with the way President Bush had argued for the war and the way he had conducted the war. Many were unhappy with Bush for things like his attempt to privatize Social Security in his second term. Above all, however, Americans were unhappy because the economy was collapsing by the time that the election started. The election occurred as the worst economic slump in the US since the Great Depression was getting started. Americans tend to blame economic problems on the president and his (or someday her) party. This meant that Obama had a major advantage because the Republicans were seen as the party that had allowed the recession to happen. I would argue that this was the most important of the factors that I cite here.
Again, however, you should check to see if there is a particular answer that you are expected to give in your particular class.