Word your retirement announcement so that you look back on your career fondly. The retirement announcement should also leave the door open so that you have the option to pursue opportunities as they come up in the future.
One example of wording a retirement announcement to maintain flexibility might read this way: "I am bidding farewell to my current position at this company on August 31. I have loved my time here, and I've enjoyed working with my incredible team. After over 20 years, it's time for a new adventure. I'll be going on a sabbatical, taking a long trip or two with my family, and then I'll think about the next part of my life. Thanks so much to everyone who has made this an amazing time."
Before posting this sort of message on your social media accounts, though, communicate with your staff and colleagues with whom you have a close, personal relationship. Send personal notes to those in your organization who have been important to you, as well as to colleagues in the profession who work with other companies. Personalize the messages so that each recipient realizes the value that you place in their contributions to your professional life.