Just curious, what is the purpose of using a resistor and how is it used?

Thanks, Jag