How does Sleep Tracking work?

Sorry if this has been asked but I just got my 47mm Wyze Watch and it hasn’t tracked my sleep, does the heart rate reader have to be on for it to collect data or do you have to do something before you go to bed?

Thanks

Seems hit and miss to me. Sometimes it tracks and sometimes it doesn’t.