TV shows basically have two fates - overstaying their welcomes or being cut down too early. Not saying there isn't one, but I can't think of a single show that ended just right. I'm also not a loyalist. I can't think of a single show that lasted more than a couple-three seasons that I watched in original airings from first episode to last except Buffy, the Vampire Slayer. That was out of pure loyalty as season 6 sucked and season 7 just avoided those lows but also avoided the highs.
Probably the shows closest to ending right were Homicide: Life on the Streets and Farscape. The first is the best cop show ever but ran a season too long (though the 7th was still okay - they just had to replace too many cast members and made a mistake in replacing the sets). I only saw the early seasons later on DVD so I might have felt differently otherwise, but that's one that I retroactively saw from first to last. (The very first seasons are so superb that I might have felt there was too much drift to stick through to the end. As it was, the middle seasons were great enough but the drift from them to the last wasn't so bad. And then I only found out later how phenomenal the first ones are, so I still like them all.) And the second ran a season too short, probably - but I doubt they'd have really written season 5 as a finale season the way it should have been if it hadn't been cancelled. And The Peacekeeper Wars at least tried to cushion the blow. But that was one I also saw only retroactively, having caught random chunks of random seasons (stupid local station) in reruns before buying the DVDs.
So, like I say, every show that wasn't premature probably ran too long. But "overstaying their welcome" and "jumping the shark" are two different things. Shows pretty rarely jump the shark, I think, in the strictest sense. And usually not long-running shows - most JTS shows are retoolings of young, near-death shows in desperate attempts to survive. I know the classic examples, such as the namesake Happy Days, are exceptions.
Either way, the lamest shows are the ones where you find there's no bottom or when they try to carry on without essential original cast. The X-Files managed to achieve both. I never watched it, but I gather many Lost fans learned the pain of the bottomless handwaving non-conspiracy conspiracy show, like the X-Files.