When LED light is falling on LDR1, its resistance goes low in comparison to R1 and as a result pin 2 of IC1 goes high. Consequently, output pin 6 of IC1 goes low and LED2 blinks while piezobuzzer PZ1 stops sounding. This indicates that the gate is closed.
When anyone opens the gate to enter or exit, the light from LED1 falling on LDR 1 is obstructed and its resistance goes very high. As a result, pin 2 of IC1 goes low and output pin 6 of IC1 goes high. LED2 stops blinking while the piezobuzzer sounds. This indicates that the gate is open.