Hillary's campaign made some major mistakes (the caucuses, etc)
Obama road the hope & change wagon. He got the youth vote (many who don't get into political details), 95% of the black vote, and the very wealthy liberals to back him. He split Clinton's base of support. The Clintons always counted on a large % of minority vote, which she did not get. Also, I think her personality turned off many young voters. There's zero question that she was better qualified compared to Barack, who is really a first term senator with a strong backround as a community organizer and champion of the poor & minority rights in south Chicago.