There is an organ in the brain sensitive to light changes, which then affects our sleepiness.
This sensitivity to light changes will determine our response to melatonin that influences our level of 'tiredness'.
The more melatonin that we have in our body, the more likely we feel sleepy and fall asleep.