I obviously can't say for sure how it works as I'm just an end user, but I can say you tell the device you are going to sleep and when you wake up. In between, it is obviously sensing your movement using the accelerometer, etc. My guess would be if you fidget around while you sleep this would be considered a light sleep.
I would suspect this to be true- Fitbit works in the same way. Sleep is an activity like any other so periods of movement above the threshold are seen as interruptions.