What is the use of a pull-up resistor? It is required when the circuit includes Push Button. You might be wonder about what does that whole term pull-up resistor means because you are familiar with the resistor term.
All digital input use pull-up or pull-down resistors to set the default state of the input pin. For Example, Consider a circuit containing a Push Button, if the Push Button is closed then it will give HIGH value but when it is closed it will give any arbitrary value (called floating condition) due to electrical noise.
To prevent this happening Arduino uses the concept of the pull-up resistor. In Arduino digital pin has 10 Kohm resistor connected to it via 5 V to the ground. During open condition, it will flow through resistance path that is pull-up resistor so, there would be no floating value or value due to electrical noise or anything.
The above fig. is a circuit diagram of how pull-up resistor connected. MCU is a microcontroller unit that you can consider as Arduino, that VCC is power supply pin.
There is one more thing like a pull-up resistor that is pull-down resistor, it is working the same way as the pull-up resistor and there is only one difference in the circuit diagram.
Pull-down resistors are connected to digital Pin via 5 V source.