system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5 How do sleep tracking apps work

I have a sleep tracking app on my phone. How does it work, and how accurate is its measurement of deep and REM sleep? 

I have seen previous eli5 on this but none I saw explained the underlying mechanism, what the difference is between deep and REM sleep and how it's detected etc.
gpt
Ever watch someone or a dog dream? They are all twitchy.  The phone picks that up.  Or you shift positions.  You move if you are in light sleep and it tracks how much you move.  That way you can tget a feel for if you are twitchy or tossy turny. It counts the peaks and determines how many sleep cycles you had.  They also record snoring so you can see if breathing trouble is hindering your sleep.