Jealousy and race were probably the main drivers of 2012. An overwhelming number of people were jealous of Romney because he was wealthy and Obama used that to great effect. Obama also got about 97% of the African American vote. There were about 20 voting districts in Philadelphia where Romney did not get a single vote, same in Chicago.
Obama had many failures and was constantly lying, but Romney never attacked him for it.