The Nielsen company doing surveys of a percentage of households is how they know. Nowadays they even have a tracker you wear that reports back to Nielsen what you’ve been watching/listening to based on what it can hear, in the old days it was a form folks filled out saying what they watched or listened to
My work had something like this to detect drug usage on premises for a while (it was and is a problem still) and it costed like 30k capital and 2-3 opex a year. We had it for like a year and only took it out because there were too many false flags and security didn’t and doesn’t have the staff to be chasing down every alert anyway.
It was neat that on paper it was able to detect different drugs, heroin, weed, meth all flagged different alerts with 2 of those contacting police when detected. Unfortunately it was only like 70% accurate and we didn’t/don’t have enough security staff to use it properly so it’s gone now.