Your car can't read your mind, but some modern vehicles can get surprisingly good at figuring out when you're losing focus. If you've ever seen a little coffee-cup symbol appear on the dashboard and wondered how the car knew you were tired, the answer is a lot more interesting than a simple timer.
The car is watching what you do behind the wheel. Depending on the system, it can analyze things such as steering inputs, lane position, driving patterns, and even your eye movements. It's essentially looking for changes that suggest you aren't driving the way you normally would.