The Conventions
The national conventions of both major parties are held during the summer of a presidential election year. Earlier, each party selects delegates by primaries, conventions, committees, etc.
At each convention, a temporary chairman is chosen. After a credentials committee seats the delegates, a permanent chairman is elected. The convention then votes on a platform, drawn up by the platform committee.
By the third or fourth day, presidential nominations begin. The chairman calls the roll of states alphabetically. A state may place a candidate in nomination or yield to another state.
Voting, again alphabetically by roll call of states, begins after all nominations have been made and seconded. A simple majority is required in each party, although this may require many ballots.
Finally, the vice-presidential candidate is selected. Although there is no law saying that the candidates must come from different states, it is, practically, necessary for this to be the case. Otherwise, according to the Constitution (see the 12th Amendment), electors from that state could vote for only one of the candidates and would have to cast their other vote for some person of another state. This could result in a presidential candidate's receiving a majority electoral vote and his or her running mate's failing to do so.