One of my all-time favorite shows, NewsRadio, was forever on the verge of cancellation, it was short of a miracle that it lasted five years. Its luck ran out only after Phil Hartman was murdered, and NBC finally had a good excuse to cancel the series. Even then, they let it run for one more year after Hartman's death.
Futurama is being ended against Matt Groening's wishes.
According to Zucker-Abrahams-Zucker, they knew that Police Squad was going to be cancelled even before it aired, after they and the network had a big fight as to whether or not to put in a laugh track. Sure enough, lasted only six episodes, but long enough to earn a cult following that led to the Naked Gun films.
Star Trek of course survived for one extra season after its fans mounted a massive campaign to save the show after it was announced for cancellation.
In 1971, CBS decided that it wanted to develop a younger and urban fanbase, and decided to cancel a bunch of shows that were rating highly, but appealed to rural and elderly viewers. Most famous of the casualties was Beverly Hillbillies, others included The Andy Griffith Show and Petticoat Junction. In relation to this, The Simpsons will survive for as long as it remains the number one show for the 13-25 age group.