"Hillary lost the election immediately after she called millions of Americans deplorable "

-

That was absolutely a huge blunder, but it wasn't the only factor. There was also:

Anti-establishment sentiment
Hillary's baggage
Racism
Misogyny
Xenophobia
The Dunning-Kruger Effect (bigly)
Poor ego-development, delusion, avoidance
Electoral College distortions
Partisanship
Russian meddling

...in no particular order.