Because warm air holds more moisture than cool air. When your lights go off, temp drops, RH rises. If temps drop enough then RH will reach 100% and then dew forms. That is, there is more moisture than the air can hold and it drops out and forms dew.