So this is as basic of a circuit as you can get with the LM311.
Since this is a night light circuit, we want the LED on when it is dark and off during daylight conditions.
So we use the potentiometer as a calibrator. We tune it so that the LED is off during lit conditions and on during dark conditions. Tune the potentiometer so that this is the case.
This comparator circuit then compares this reference voltage with the voltage produced from the voltage divider between the photoresistor and the 33KΩ resistor. It's a really simple concept. When the photoresistor is exposed to bright light, its resistance falls well below 30KΩ. Therefore, most of the voltage gets allocated to the 33KΩ resistor and little goes across the photoresistor. Thus, the voltage produced by the voltage divider is less than the reference voltage. Therefore, the output is drawn to GND, which means the LED is not powered. However, during darkness, the photoresistor has a very high resistance, so most of the voltage gets allocated across it. Thus, the voltage produced from the divider circuit is above the reference voltage. Thus, the output is drawn high to Vcc, and the LED turns on.
And this is the basis of our voltage comparator circuit.
To see in this circuit in real life, see the video below.