A hit show takes Hollywood magic indeed, but it also takes a lot of math and science, plus the study of polls and trends to make and sell a TV show.