The Fitbit tracker knows you are asleep when the motion sensor registers a lack of movement for a period of time. We use algorithms based on heaps of academic sleep research and this is switched on when you press the button for 1 second to go into "sleep" mode.
Two sensors inside the tracker...