The resistor in this case is called a "pull up" resistor. When you configure a pin to a microcontroller (or, almost any modern digital logic chip) as an input, it is not a good idea to leave it unconnected to anything. These inputs are essentially a capacitor, and there's a danger that they can pick up a partial charge that causes them to 'float' to a voltage level that is not legal for a digital input. This can cause problems ranging from inconsistent input values, excessive power consumption, and even (in extreme cases) damage to the chip.
In the circuit you are referring to, when the button is not pushed, the resistor connects the logic input to +5V; a nice solid "1" input. When you DO push the button, the button provides a much lower resistance path to ground for the input, and it reads a nice solid zero. If you replaced the resistor with a plain wire, you would short out the supply through the switch and wire, and possibly burn something out (as you say.) (when the resistor is in the circuit, it limits the current to a value that is safe for the switch, the wire, and itself.)