To win the nomination of the Republican or Democratic party a candidate must be selected at the party's national convention. The delegates at that convention are chosen in

contests held around the country where voters cast votes for their chosen candidate

in primary elections or caucuses. These contests are held in each state and territory, and the results determine how many delegates each candidate receives. The candidate with the most delegates at the national convention wins the party's nomination for president.

The process of selecting delegates varies by state, with some states holding primaries where voters cast ballots for their preferred candidate, and others holding caucuses where voters gather in person to show support for their chosen candidate. Delegates are typically allocated based on the percentage of the vote a candidate receives in each contest.

The national convention is where the delegates officially vote to nominate a candidate for president. The nominee then selects a running mate to be their vice presidential candidate. The party's platform is also finalized at the convention, outlining the party's positions on various issues.

Overall, winning the nomination of a major party is a lengthy and competitive process that requires a candidate to build support from voters across the country and secure the majority of delegates at the national convention.