I decided to retire when multiple factors crystallized to make my decision easier. Like you mentioned, my motivation was flagging, and I started noticing that my thinking was slowing down. I had adjusted to the stress of the job for several years, then it started to grind on me again. I would work all week, then be sick or exhausted the entire weekend. I'd start feeling like I had some energy just in time to start the shit all over again. The added stress of my mother-in-law and father-in-law both declining from dementia and stomach cancer respectively wore even more. I was exhausted all the damn time.
I had other projects that I wanted to finish, but being passed over for a promotion and having my workload doubled at the same time made it clear that it was time to go. I stayed two months to finish a major report and finish training others on my job, then retired.
It was the best decision that I have made in a long, long time. I am another person. I'm not sick all the time, and I have time to spend with my dad in his twilight. We're not rich, but we're able to pay the bills and have a little left for some fun. Honestly, I should have retired five years before I did.