The winner of the election is determined through a system called the electoral college. Each of the 50 states, plus Washington DC, is given a number of electoral college votes, adding up to a total of 538 votes. More populous states get more electoral college votes than smaller ones.
A candidate needs to win 270 electoral college votes (50% plus one) to win the election.
In every state except two – Maine and Nebraska – the candidate that gets the most votes wins all of the state’s electoral college votes.
Due to these rules, a candidate can win the election without getting the most votes at the national level. This happened at the last election, in which Donald Trump won a majority of electoral college votes although more people voted for Hillary Clinton across the US.