system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do networks know how many people are actually watching a show?
gpt
It depends on the medium.  
Online they can actually get pretty good numbers, while they don't know how many people are watching a single screen, they do know how many devices requested a copy of the show.  They also don't know the demographics who watch shows online, but use other tracking methods to estimate which demographics viewers belong to.  

For TV, obviously they don't get detailed information like that because the technology doesn't work like that.  This means they use statistics and sampling to try to make up for the lack of direct feedback.  Neilsen ratings are the most popular of these.  They first asked for TV show diaries, but eventually moved to set top boxes.  These have a number of known sampling problems.  

For the self-reporting, people know that they're being watched.  This causes them to leave out shows they're ashamed of watching, or marking down that they've watched shows they thought they ought to but in fact had not.  

For the set top boxes, the problems are different.  First, even choosing a representative sample to start from is difficult.  Out of that, people have to accept the boxes so the numbers are distorted away from shows that the type of people who don't want a Neilsen box in their home like to watch.  Even within households, they attempted to measure demographics (who's actually watching) and this again encountered some of the same problems with self-reporting where family members would enter someone else's code because they were ashamed at what they were watching.  

In short, to answer your question of how they know how many people are watching a show, they don't.  They ask a fraction of a percent of the general population to take these surveys, then multiply those numbers to estimate how much of the general population watches any particular show.  There are a number of problems in the survey and those problems get multiplied when those numbers are scaled up.