A good argument can be made that it took a "perfect storm" of mostly unexpected events to produce a Trump victory. I would put the factors into 3 general categories: underlying (historical/structural?), campaign (strategy and tactics), and contingent (unexpected events).
An example of "underlying" would be the several-decades rise (in the U.S. and worldwide) of "reactionary populism," the alienation from, fear of, and anger at many aspects of the modern world - globalization, terrorism, immigration, feminism, etc. The Clinton team never had a plan to straightforwardly contest the Trump promise of "change." She might have argued that Democrats, too, wanted change, but change looking forward to the 2020s, rather than change looking backward to the 1950s (when white men ruled the country). She talked about jobs, but too seldom directly to struggling white men. "Reactionary populism" is in a sense a primal scream against the last half-century.
An example of campaign strategy would be the Clinton team's reliance on the "ground game," the well-organized plans to get out "reliable" Democratic voter groups. But Team Clinton collectively had a tin ear, missed signals that no segment of the Obama coalition was as reliable for Clinton. African-American voters in several key states simply did not vote. A higher than expected % of Hispanics voted for Trump. Some educated women voted for Trump. Many Greens voted for Stein rather than Clinton, despite the fact that Trump said climate change is a hoax. Go figure.
Examples of the contingent, the unexpected, are many. Clinton's remark about many of Trump supporters as "deplorables" was unbelievably foolish. Broader examples of unanticipated developments would include Russian interference, Wikileaks, and FBI Director James Comey's bowing to pressure from inside the agency to imply - on the basis of no actual evidence, as he announced 10 days later - that newly discovered Clinton emails might contain prosecutable information. All of these particular unexpected developments are, going way beyond this campaign, very ominous: hackers, the highest level of tne Russian government, and the FBI interfered in American elections. Most ominous of all: roughly 50% of voters (and arguably more, as tens of miiilions of eligible voters stayed home) didn't much care.
Willful ignorance is dangerously stupid.