For what it's worth, here is my analysis, in no particular order:
1- Hillary has been attacked for more than a generation. A lot of it was dumb, some stuck. She was maddenly tone deaf on some issues, e.g., "deplorables" and a unifying message.
2- as the Clintons once said, it's best to appear strong tho wrong (Trump) than weak thought right.
3- the left, especially portions of the academic left, loses people when it suggests that an unemployed coal miner is "privileged" by his whiteness. Fundamental big advantage being white, but those closed factories employed minorities too.
4- in that vein, the GOP's southern strategy and voter suppression have been successful for years now. There is little reason for working class whites from the south to vote against their economic interests, but see number 2 above. Jesse Jackson's speech to that effect is lost in history.
5- years ago, I read that most US passports are used once in a lifetime to travel abroad. Assuming that is still true or close to being true, our voters are fairly unsophisticated about foreign affairs. I remember when we invaded Iraq, more than one person interviewed suggested it was payback for 9/11. But with a large country, only two friendly borders, comparatively little exposure to foreigners, never having been invaded, we pay scant attention to foreign affairs. Trump waves his member at the world and people cheer. Doesn't mean that we are dumber than Europeans, but we on the left keep hearing "keep your government hands off my Medicare" and wince at our casual attention to politics.
6- more people voted for Hillary... A few thou switched here and there and she would be prez.
7- so much the worse for her... It never should have been close.
Nevertheless, when someone says he will do things (torture and killing children of terrorists) that we hanged people for, says he will ban a religion, moves his family and family business into the White House, is so transparently corrupt, discovers that health care is complicated, and lies so blatantly, with magical ease... It's scary.