The circuit as shown act as a light detector. Under normal conditions the resistance of the LDR is high, keeping pin 2 low. When light falls onto the LDR the resistance drops to a couple hundred ohms and triggers pin 2 high which biases the base of Q1 via pin 6 and R4 and in turn activates the relay.
The second voltage divider will settle the reference voltage. The first voltage comparator that contains the LDR, will change it's voltage according to the light level. When the voltage across the negative input of the comparator is less than the voltage to the positive input of the comparator, the output is held low. When the voltage on the negative input rises, there will be a time that it becomes greater than or equal to the positive (pre-selected) voltage, and then the output becomes high and the relay through the 2N2222 is actuated.