My best guess is that it's there to drop the voltage down to 0V by the time the current reaches the negative terminal but I'm not sure if that's the case; and if it is, is it absolutely necessary to be there and why exactly? Also a side question: Why is the voltage dropped to 5V in the beginning of the circuit, wouldn't it work if it remained 9V?
What is the exact purpose of this 2.2 kOhm resistor in the circuit? [...] is it absolutely necessary to be there and why exactly?
Its purpose is to form a voltage divider with LDR (photoresistor). The resistance of LDR varies with the light intensity. The resistor turns the variable resistance into a variable voltage, which is then compared to a reference voltage that you can control with the potentiometer.
Yes, it's necessary in this circuit, and most other circuits using an LDR.
Why is the voltage dropped to 5V in the beginning of the circuit, wouldn't it work if it remained 9V?
You're right here. Due to the circuit's construction of only relying on the relative resistances, the circuit would work fine (even better) without the regulation. You would only have to change the resistor after the LED, because the output from the operational amplifier will be closer to 9 volts than 5 volts.
One minor benefit of having a 5 volt regulation is that you will only get at most 5 volts out of the operational amplifier. This could be useful if you want to connect it straight to a digital input.
Note that the μA741 amplifier chosen here is a pretty bad choice, but why it is so is another question.
This question wasn't asked but I thought it might be useful information for you.
Why is it a 2.2K resistor? Can I just use any resistor?
It's all a matter of sensitivity, the LDR will be the most sensitive to light changes in both light and dark if your fixed resistor is a similar resistance to the midway point of the LDR.
I've plotted a little graph so you can see the effect of using different fixed resistors for the LDR in your circuit schematic
The sensor is a LDR, which changes resistance when exposed to light. The circuit is a operational amplifier, used as a comparator, that will turn on an LED when a certain level of light is reached.
Comparators respond to voltage, not resistance, so somehow, the resistance value of the LDR must be converted to a voltage. There are a few ways to do this. One, which is not real common, is to use a constant current source, and then the voltage across the LDR would be proportional to it's resistance.
Another way to is put the LDR into a voltage divider. The 2.2 KOhms forms the lower half of the voltage divider.