Most states hold primary elections. The purpose of a primary is for each of the parties (Democrats and Republicans) to choose the delegates that will go to the National Convention. We voters seemingly vote for a single candidate, but we are in fact voting for delegates who have pledged to vote for that candidate in the first round at the National Convention.
At the National Convention, the delegates will choose which candidate will receive the party's nomination. The Dem's will choose a candidate at their convention and the Republicans will choose their nominee at their convention. Then, the nominee will announce their choice for their vice presidential running mate, the delegates will approve them.
Then we voters will choose between those two(Democrat & republican) for President (and the independent, green party, communist, etc. random parties too, but really it comes down to democrat or republican).
A few states hold caucuses which are more like meetings than just going and voting. It's a bit confusing.
Does that clear things up at all?