A pull up resistor circuit is one of the most common ways to interface a switch to a logic input like a general purpose I/O pin on a microcontroller. Most inputs require that the voltage be above some threshold or below some threshold. If the circuit is simply disconnected the input would be allowed to float and it’d be anybody’s guess what the value of the input pin would be inside the chip. Most newbies learn this the hard way.
This circuit is the most intuitive way to interface to a microcontroller or logic chip and it is VERY wrong. When the switch is open it will cause the input of the chip to float. Depending on the device this could lead to undefined operation of the input, oscillation between states, high power consumption or even physical damage to the device. The answer is the pull up resistor.
When the switch is open the voltage at the input pin will be very near Vcc. The input has a very high impedance. This means that very little current flows through this circuit so there will be very little voltage drop across the resistor.
If we close the switch. All the current will flow through the resistor and the switch to ground. Now the voltage drop across the resistor will be Vcc so the input pin will see a voltage that is very near ground. This is how we make sure that the input pin of the microcontroller will never see anything except Vcc or ground.
Many microcontrollers have internal pull up resistors that can be enabled in software. This saves some space on the circuit board. I have also used resistor networks when I have several switches that I need to pull up. A typical value for a pull up resistor is usually betweeen 10k and 100k Ω.