My own view (not "the answer", but a rational conclusion) is that HRC and the Democratic Party leadership lost the election to an unqualified caricature of a caricature, possibly THE most unlikable and unqualified candidate in history. Why did Trump get elected? To wit:
First, HRC's weaknesses:
- HRC's own unfavorables, clear to most early on, were only slightly better than Trump's.
- Few, especially of younger generations, could relate to her; some I knew said every time she spoke they sensed a lack of genuineness.
- Younger feminist women I knew were angered by what they considered "faux feminism"...the claiming of that mantel when her values and many of her policies undermined women around the globe and offended their sense of feminism.
- Her record, whether on helping to keep single-payer off the table, or as Senator from NY (such as her support for bankruptcy "reform" that benefited the finance industry at expense of the poorest), or with respect to promoting harmful trade policies (TPP), fracking and oil & gas pipelines; coupled with her close ties to Wall St.... all this was quite visible to those who cared to look.
- The steadily widening gap between the wealthiest few (the so-called 1%) and the rest of the nation, and growing underclass, which occurred no less on Democratic watches (her husband's policies exacerbating it, while Obama was unwilling or unable to do much better, and was even promoting another horrible trade deal undermining workers' (and the planet's) interests.
- The unfair advantages conferred upon her & unfair treatment of Sanders by the DNC, and the obvious collusion with mainstream media caused many to distrust her even more.
All of the above led to a defection by too many Democrats, and a loss of interest by very many unaffiliated voters. One clue to this is the large number who left the top line of the ballot blank; another is the number of third party voters - though the latter probably affected both DP and GOP.
On the Trump side, of course there was his "base"... those who responded to the dog-whistles of racism, xenophobia, religiously-cloaked bigotry and authoritarianism; and who would have supported whatever right-winger did so. I'd guess (and certainly hope) this was just a fraction of Americans - maybe 15%.
There were also many "persuadables". I put in this category those R's who disliked Trump and would've gladly voted for a sane alternative had they felt their was one. I met such people: lifelong R's who said they were prepared to vote Sanders if it came to him against Trump; but when Sanders was eliminated went back to their R roots.
- A subgroup of the persuadable were those who, while Democrat-leaning, disliked Clinton for any of the above reasons and were motivated to accept Trump's words about "cleaning out the swamp" or about more productive engagement with Russia and other powers, his mistrust of the intelligence establishment, or of wanting to scrap TPP and renegotiated NAFTA for the betterment of American workers.
Then, there were many who simply wanted to "throw a bomb into the system"... who were so frustrated by the "establishment" in general and seeing that Trump was at least hated by the establishment, were willing to set off the bombs.
This is my synopsis of what happened; based on polls and my readings far and wide and conversations with numerous folk prior to and after the election.