You might wish to leave/retire on a high but when things are going well and everyone wants you to stay it's hard to leave. Unless of course you receive an offer you can't refuse! The truth is that often you don't get to decide when to go. All you can do is jump before you're pushed.
Some people claim good leaders don't fail, saying they were just unlucky and that events conspired against them. Others point to having the wrong people around them, being given faulty information or bad advice. Some believe leaders simply run out of ideas, energy and enthusiasm. Either that or they continue to apply the ideas that worked so well in the past to new problems with diminishing success. There are exceptions who reinvent themselves and do it all again one more time - but not many.