For those of you unfamiliar with the weirdness that are American presidential elections they don't work like you would think that they do. It is not as simple as people voting, votes being counted, and a winner declared. Instead we have this whole multiple months long series of choreographed events, complete with fancy costumes and funny hats, that occur between early December and Inauguration Day, which is January 20th.
For the Americans out there that feel like they have a grasp on this, please feel free to skip ahead. For everyone else, this is how things go down:
First we have the actual voting, which has already started in a lot of states through people sending in ballots or going to the Board of Elections to vote before election day. Those votes are stockpiled and counted only after formal voting has ended. On November 5th (always the first Tuesday in November) everyone else will show up and vote, if that is something they want to participate in.
On the evening of the election the results that are given on news channels and in online columns are provisional, and based on the vote counts in each state. The totals that we see on election night are based largely on in-person voting, for one very clear reason. On election night the ballots cast in person are secured, taken to a central location, and counted. In the modern era voting machines provide provisional results, which news stations then use for their projections, but these are not official, and will not be for some time. In the days following the election, the absentee ballots and provisional ballots are counted, which can change the outcome.
The outcome of the vote totals is a really odd system called the Electoral College. Within this structure the popular vote for the presidency exists almost as a futile exercise of suggestion. It does not actually matter whether someone won the popular vote, they can still lose the election. Each state has a number of Electors equivalent to the number of House and Senate representatives that state has. In the Electoral College system these Electors are supposed to gather and cast their ballots, and it is the total of those votes that elects the president.
This has led to a situation in which George W Bush and Trump lost the popular vote and they still became President. The reason for that is that the Electoral College is not necessarily a reflection of the population. Every state, even the smallest ones, have 2 Senators, and therefore at least 3 Electoral votes, even though the whole state of Wyoming, for example, has less people than the metro area I live in. This gives small, rural, states a lot more power in deciding the presidency than would otherwise be the case if that were determined by population.