First, the candidate must be nominated to run as the Republican or Democratic candidate for President. (I am ignoring the procedures for other parties because there have been very few serious "third party" candidates in history.) This is done through a process of winning delegates in primary elections and caucuses in the various states of the country. Whoever wins the most delegates gets to run for President as the Republican or Democratic candidate.

Second, the candidate must win the general election. This happens in November of the election year. In order to win, the candidate has to win a majority of the electoral votes. Each state has a number of electoral votes equal to the number of Senators and Representatives it has in Congress. Almost every state gives all its electoral votes to the candidate who wins the most votes in the state. That means that a candidate who wins 51% of the vote in the state gets 100% of that state's electoral votes.