Answer:
The presidential ticket is selected by the delegates. The delegates are sent from the states after the primaries have taken place, and they are pledged to a particular candidate.
For example, in the 2016 Republican National Convention, the ticket Donald Trump-Mike Pence was selected by 1725 delegates which trump had "earned" during the primaries.