TV ratings based concept

I thought of this a little while back, but how do they figure out how many people are watching a TV channel at one time?
What is in our televisions that sends some signal out? Do they count the ratings from those really old TVs which have the antennae sticking out from the top?
Likewise, they manage to figure out the ratings for radio stations as well.
In fact it's a little scary how they can track what people are watching..
haha couldn't help thinking about Teletubbies and their little screens in their tummies.
Just thought someone might be inspired to expand upon this.