First of all, an aspirant for the presidency must become the official candidate of his or her party. This involves winning as many votes as possible during the lengthy primary season. Primaries are preliminary elections that take place in each state during a presidential election year. Prevailing in the primaries requires time, dedication, and above all else, money. Politics in the United States is an expensive business. Anyone with a serious shot at winning a party's nomination has to be capable of raising considerable sums.
During this period presidential candidates hope to gain as many votes in primaries as possible in order to win the largest possible number of party delegates. The same is also true of caucuses, meetings of state parties, which register their preference for candidates. The more votes the candidates win in the primaries and caucuses, the more party delegates they will have.
In the old days, parties formally decided their candidates at conventions in election year. But nowadays candidates are decided long before the conventions take place. What usually happens is that one candidate—say, Joe Biden, for example—builds up a sufficiently large delegate count that gives them an unstoppable momentum, forcing rival candidates to drop out. This gives one candidate a clear shot at the White House.
Once a party has chosen its candidate then it's on to the presidential election itself. It's somewhat ironic that the actual process of electing a president is much shorter than that of selecting the party candidates. In any case, once the campaign is underway, the candidates strive to win as many votes in the Electoral College as possible. This means concentrating on those vital swing states—such as Wisconsin, Michigan, and Pennsylvania—which tend to decide the final outcome.
Even if a candidate wins the popular vote, that's no guarantee that he or she will in the Electoral College. In 2016, Hillary Clinton beat Donald Trump in the popular vote by almost three million votes. Yet Trump won the election because he prevailed in the Electoral College.