Obama was elected because that election followed 8 straight years of Republicans in power, in which they squandered the world’s sympathy after 9/11 by starting two retarded wars, opening guantanamo, curtailing freedoms, going after journalists etc. Bush Jr. and the GOP was lambasted 24/7 at home and abroad by the likes of the Daily Show, (much more mildly but) not unlike Trump is today.
Obama was charismatic and his platform of hope and change was powerful, but it did hinge on the GOP being absolutely unelectable. Kamala Harris may have won this year if Trump had won in 2020, although it’s easy to imagine the Dems squandering that as well, by explicitly running on not-being-the-other-guy, which Obama didn’t do.