Sleep tracking generates reports that register not only how long a person was asleep but also how much of that time was split between light and deep sleep. The latter is what humans need the most, as it is the most restorative kind of sleep and the least likely to be disturbed by external stimuli.
As the number of tracked nights increases, users can access valuable insight into their sleeping patterns. If you, for instance, get enough hours of sleep but are still tired in the morning, one of the many possibilities is that you're remaining in the light sleep phase. Bear in mind that sleep tracking features are mainly guided by movement tracking (although some devices also take heart rate tracking into account), and circumstances can lead to inaccuracy.
Almost every smartphone, smartwatch, and tablet come with both an accelerometer sensor and a vibration sensor. Apple Watch sleep tracking and Galaxy Watch sleeping tracking will use these tools, sometimes along with audio collected from the microphone in the device to analyze your sleep patterns using an algorithm. According to the output, the algorithm is able to tell the device, via an app, how long you were asleep and what the quality of that sleep was.