Slotting TV shows is a complex bet by the networks to maximize not just the ratings but to get the best "demo"--short for demographic, the right kind of viewer--to max out ad revenues, the real bottom line.
It's complex because even if one show is a hit, broadcast networks have to take into consideration what the other channels are doing not just directly opposite but before and after. Why run new episodes of a program if they are going to get crushed by the Oscars, or the Superbowl--or maybe we'll attract the crowd that's sick of those events.
If one show is a big draw, does that viewership flow over into the next program? Should we run a comedy before CSI or a look alike show--will the eyeballs stick to our channel or do they move when we go to commercials? (One reason why TBS and TNT started running programs 5 minutes before or after an hour--in theory less chance of losing people at the top of the hour)
Changing time slots is another big gamble. They'll look at a show like "King of Queens", a steady player on Weds, but decide maybe the show is past its peak of drawing new viewers. The fans will follow it to Monday, where it fits in at 8 PM nicely and hopefully draw some people into "How I met Your Mother", a new show that has maybe half a season to draw acceptable numbers, and not lose too much for KoQ. But if HIMYM is good, then as KoQ slowly draws to an inevitable close, they have a replacement and new fans in place.
It's a big gamble since the channels put a lot of money into development and promotion of these shows, and as we all know, people develop viewing habits that are actually pretty hard to change in the short term.
Add in the cable channels, pay on demand, DVDs, HBO, and things like the internet, which is drawing more and more eyeballs away from the traditional networks. To me it's an interesting problem since they all have different strategies: HBO is 'event' TV--you'll seek out the Sopranos, which is a great lead in for "Big Love", a new show that you'll hopefully try. HBO doesn't need to worry abour ratings per se, and they only reach who knows how many homes, but a network show needs to do "x*" in the ratings to stay on, period.
Networks, where the programming is free, have other issues. They need to fill x amount of hours every night, even as attention spans and working hours have changed. The old formula--sitcoms and cop shows, solid since the sixties--is doing ok but they're getting sniped at every corner.
(*"X", by the way, has fallen dramatically. I read that Seinfeld, at its absolute peak, drew fewer viewers than original Star Trek, cancelled in 1969 for low viewership. Over the last decade when syndication was a viable option for shows we saw lots of shows like Xena or ST:Voyager that had actually very low viewerships versus traditional networks but are successful because they had a cost structure and a demo base that supported the stations that showed them)