Behind TV ratings are sample panels, peoplemeter devices and audience calculations that shape the advertising market.