This process is called a nomination.
In national politics, this is done through primaries and caucuses. When a person considers running for president of the Democratic or Republican party they go through a series of statewide elections. These state by state elections allow citizens to vote on who they want to run for president of a particular party. Eventually, the person who wins this process will then be officially nominated by the party at a national convention held in the summer of the election year.