A pull-up resistor effectively establishes an additional loop over the critical components, ensuring that the voltage is well-defined even when the switch is open.
For this, it is assumed that the critical components have infinite or sufficiently high impedance, which is guaranteed, for example, for logic gates made from FETs.
In this case, when the switch is open, the voltage drop across a pull-up resistor (with sufficiently low impedance) practically vanishes, and the circuit looks like a wire directly connected to VCC.
This current, which is essentially wasted energy, only flows when the switch is closed, and technically for a brief period after it is opened until the charge built up in the circuit has been discharged to ground.
Many microcontrollers intended for embedded control applications have internal, programmable pull-up resistors for logic inputs so that not many external components are needed.
A standard TTL input at logic "1" is normally operated assuming a source current of 40 μA, and a voltage level above 2.4 V, allowing a pull-up resistor of no more than 50 kohms; whereas the TTL input at logic "0" will be expected to sink 1.6 mA at a voltage below 0.8 V, requiring a pull-down resistor less than 500 ohms.