It is the electoral college votes that are cast for the nominees that puts that entire state for a candidate.
For example, if most of Florida - a key swing state - votes for the Republican nominee and a few key cities (Tampa-Clearwater, Orlando, and Greater Miami-Dade) go Democrat - the entire state must give all it's electoral votes to the Democrat nominee.
That is written in the Constitution.
|