This is the famous internal pull-up, which most people do not understand. When we want to read the state of pin D13, we set it to pull-up: the current flows through the resistor and the pin will always stay at value 1 (HIGH). However, if we connect it to ground (0) from the outside, the value drops from 1 to 0. This keeps the pin from floating "in the air" and catching electrical noise, holding it securely to the positive side through that resistor.