The presidential candidates are elected by their respective party at the national conventions in the summer.
Primaries, for the most part, are a relatively recent phenomenon to make the process to select the delegates to attend those national conventions more inclusive. Before 1968, most states did not have primaries, but had elections for party delegates that most voters ignored.
Now the primaries put a face on the delegate selection process, the candidates visit more states and as a result more people participate. When you vote for Clinton (or McCain), you are in effect voting for her (his) delegates to attend the national convention.
In the Democratic primaries, the awarding of delegates is proportional, so that a candidate can lose the popular vote and still win delegates....a candidate who loses 51%/49% will get the same number of delegates as the winner (eg, Clinton won the vote in Nevada, but Obama got more delegates because he beat Clinton in districts he won by more than he lost to Clinton in districts she won)
The Republican party has many winner-take-all primaries, either statewide or by Congressional district....so a candidate can win 51/49 and the loser gets no delegates.
If all that makes sense