First of all, no one likes an ending like the one in Megaman 4, where Dr. Wily escapes through a hidden door right in front of Megaman. It basically says "Thank you for reading/watching/listening/playing! Get ready to fork over your hard-earned cash for the sequel in a few months!".
If you're going to want a good, definitive ending, the ending to Return of the Jedi is a good example (arguably, the special edition is the better example in this case, but either one works). It gives a conclusion to every story sub-arc in the series that hadn't already ended, and it does it well.
Another example would be the ending of Stargate Atlantis. It's essentially a climax and conclusion wrapped into one, which usually doesn't do well but in this case worked pretty well.
For video games, I'd take a look at Final Fantasy 6. You'll really have to play the game or at least watch the ending to see what I mean.
There's also the first-gen Pokemon games, in which, again, the climax and ending are tied together but in a good way, and I personally felt the ending to the main storyline of Pokemon Black and White versions was relatively strong, if a little cliche.
Phoenix Wright: Trials and Tribulations concluded with a massive plot twist, however, if the player had already gotten that far then they would already have come to that conclusion. It's still shocking though, so I won't spoil it.
With books, obviously Lord of the Rings: the Return of the King requires a mention, but also "The Emperor's Gift", one of the Black Library Warhammer 40,000 novels.
For manga, Rurouni Kenshin's ending was pretty good in my opinion.
As for the endings I didn't like... I could go on and on about these.
First off, I already mentioned Megaman 4. Basically, any ending like that where there should be a conclusion but the story continues for no reason should be avoided.
Next, cliffhangers should be avoided in any situation where a follow-up is not intended.
The third thing you should avoid is the classic, villainous scream of "NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO". Revenge of the Sith doesn't count, as the villain doesn't exactly die in that situation.
On the other hand, No More Heroes 2. JASPER @#$%&?! BAT JR.!!! He dies... with a smile on his face... AFTER one of the hardest boss battles in video game history. And I must scream.
With video games, if anyone sticks a giant space flea from nowhere at the end, they are to die a most painful and gruesome death after watching their loved ones being pushed into a volcano. No one, and I mean NO ONE, likes a giant space flea from nowhere. Examples: Final Fantasy 9, Mario and Luigi: Partners in Time, Mario and Luigi: Bowser's Inside Story.