For me, I just have my workouts scheduled in my calendar. If I don't feel like it, tough, I go. I count everything I eat, and only eat single ingredient foods. I have to struggle to eat all my food in a day, and I eat well.
I just turned 50 last week and I have abs, so that motivates me right there.
As you know, I used to be close to 300 pounds many years ago, and I couldn't stand it. Now, I'm strong and it's an incredible feeling, but you need to get there to understand it. Once there, you never want to go back.
My wife is 14 years younger and I have a 3yo daughter, so I need to keep in shape just to keep up -lol
But there is certainly a vanity thing to it, I have guys at work 20 years younger that make comments how they wish they were in my kind of shape. That motivates too. I try to explain that wishing isn't the best strategy, but hey

I have a job that keeps me busy, 4 dogs, a 3 yo with disabilities and a ton of house maintenance to do. Oh, and a large reef tank. But training is important to me, so I make time. Sometimes I'm at the gym at midnight, but it gets done. It's not really even a motivation issue, it's just what I do. It's part of my life.