Each side of the switch goes to the Port pin. There is a Resistor, one end on the Port pin, the other is nailed to +5v. That's why they are called Pull-UP - they pull UP to +5v when the pin is unused. When you close the switch, it drops the pin voltage to 0v.