Hilary Clinton won the popular vote, but Donald Trump won the Electoral College. But in fairness, you can win the election, by only winning 13 to 15 states, due to their size of their population. It is an argument that is being made against the Electoral College, but if you add the all the votes of third party candidates, especially with what happened in Nevada, you will see that more people voted against Clinton, I recognize the argument can be made against Trump as well.
But Clinton's and her surrogates' behavior toward the those who were open to Trump, was completely rude, calling them deplorable and saying "there's a special place in hell if you don't vote for Clinton" did not help matters. Also Clinton more of less ignored the kitchen table issues that middle America cared about, while Trump hit those topics over and over again, while Trump did categorize some people with offensive labels "rapists and murders", I think the average American recognized the media misrepresented that comment.