The President of the USA is not elected by popular vote, instead the Electoral College is a body of 538 electors make the decision. There is one for each of the US’s 100 senators and 435 representatives, with an additional three electors for the District of Columbia.
In order to become President of the US, either candidate must win a majority of the electoral college votes – at least 270. With the exception of 2 states (Maine & Nebraska), an entire state's electoral college has to vote for a single candidate, for example, Florida has 29 votes and all of them would have to be allocated to either Clinton or Trump. The Electoral College system can be counter-intuitive, for example, it is possible for a candidate to get no votes in 39 states an d Washington DC, and still be elected President.
It's also possible for a candidate to win the popular vote and lose the Presidency, this happened to Al Gore when he lost to G.W. Bush in the 2000 election. Also - it is possible for there to be a tie in the number of electoral votes each candidate secures, in the event that this occurs, the House of Representatives will vote to elect the President.
Read more: https://goo.gl/mP8ihm