Primaries occur from state to state and party to party. Only voters who are registered for a certain party can vote in that party's primary. For example I am registered Republican so I cannot vote in the Democratic primaries.
Each state has a number of delegates that they send to the party's national convention. The number of delegates a state has is population-driven.
Whena candidate gets votes in the primary, the votes earned correspond to a certain number of delegates who will attend the national convention. When John Kerry gets 40% of the votes in a state, that means that 40% of that state's delegates will attend the convention on Kerry's behalf.
The nomination itself occurs at the convention - the delegates cast votes for their nominee based on how many votes that candidate received in each primary. The candidate with the most delegates wins and is nominated as the party's Presidential candidate.
George W Bush as sitting President is also head of his party and therefore does not have to go through a nomination process.