A primary works very much like a general election. On dates selected by each state, the District of Columbia, and territories such as Puerto Rico and Guam, voters head to polling places to cast secret ballots. Based on the results, the state parties allocate delegates for each candidate to the national convention, where the presidential nominee is formally chosen. At the Republican convention, the nominee will need a majority of the approximately 2,500 delegates; the Democratic nominee will need a majority of the approximately 4,700 delegates.