How did 5 of our 45 Presidents come into office without getting the most popular votes nationwide?
They did this by winning a couple of states by very small margins -- thus getting all of the electoral votes from those states -- while losing the rest of the country by a large margin.
In 2016, Donald Trump became President even though Hillary Clinton won the national popular vote by over 2,800,000 votes. Trump won because he carried Michigan by about 11,000 votes, Wisconsin by about 23,000 votes, and Pennsylvania by about 44,000 votes. Each of these 78,000 votes was 36 times more important than the 2,868,518 votes cast in other states.