How do the Presidential Primaries Work?

The presidential primaries are a process designed to pick the nominees for the office of president. This narrows down the dozens of candidates into two.