The question you have to ask is: what happens when the button is not pressed?
In your case, when the button is not pressed, the switch is an open circuit and therefore the digital in pin is disconnected. In this case, what is the voltage at the digital input going to be? It may be anywhere between LOW and HIGH, there is no way of telling that, because the pin is set as an input, which means it has a high impedance, and at the same time it is "floating", that is it is not referenced to ground. In this case the system may be unstable and your reading may be 0
or 1
in a totally random way.
By providing a "pull-down resistor" (i.e.: a resistor from the digital input to ground), then you make sure that the voltage at the pin is going to be 0V when the switch is open (button not pressed). You can then connect the digital input through the switch directly to 3.3V (no need for the resistor you had in your example).
The circuit is therefore going to be:

Note how:
- when the switch is open R1 makes sure that digital in is 0V (LOW)
- when the switch is closed digital in is connected straigt to 3.3V (HIGH)
- when the switch is closed, 3.3V is connected to ground through R1. R1 therefore limits the current flowing between 3.3V and ground. R1 has to be of a large enough value that there is not too much current flowing through it (as this current has no useful purpose in the circuit), however the value needs to be small enough that it is not comparable to the input impedance of digital in, otherwise it may not work properly as a pull-down. 10k is most of the times a reasonable value.
In order to make sure you do not damage the digital inputs: make sure you NEVER connect them to any point in the circuit that has more than 3.3V!