Democrats often win the popular vote because of very large states that are mostly liberal. Especially California, New York, and Illinois, where Democrats usually win by differences in the millions. But to win the electoral college you don't have to win the popular vote, you just have to win enough states to reach 270 electoral votes. Since there are more registered Democrats than Republicans, every Republican president has had to convince enough independents and Democrats that they were the better choice. That's exactly what Trump did. Many counties in Ohio, for example, that are normally Democrat strongholds with strong union representation, went with Trump. Note to future Democrat candidates, don't take your constituencies for granted. When people are hurting financially, don't openly state that you are going to take their livelihoods(coal mining) away to please the far left extremists and then be surprised you didn't get their vote.