The data in this article explain the results of the election better than others that I have read. Clinton won most of the affluent suburbs that used to vote Republican by a wide margin. Her margin over Trump among highly educated Americans with graduate degrees surpassed Obama's margin in the previous two elections. Trump, however, got a higher percent of white working class voters than either McCain or Romney got against Obama. That loss was most meaningful in competitive states that had been won by Obama. Few expected Clinton to do well with less educated white voters in most of the Red states. Clinton would have won the election if she had done as well as Obama with working class white voters in several battleground states. She lost ground even with white voters who approved of Obama's policies.
There are lots of graphs which break down the results in the election, but the main message is that Clinton did not succeed in reproducing the Obama Coalition that put him in office. Clinton outperformed in areas that used to vote Republican. Trump outperformed in areas that were once Democratic strongholds. His messages were designed to do exactly that. They were the messages that won the elections for Obama and lost the election for Clinton among industrial workers and coal miners. Surprisingly, they also won the GOP primaries for Trump. He won the primaries by delivering economic messages against free trade and globalization, and defending many of the popular Democratic social welfare programs like Social Security and Medicare that have been attacked by Republicans. His messages against immigration and stronger protections against terrorism were also well timed. They were amplified after each terrorist attack in Europe and the US.