Sometimes I'll re-read a book. Masters of Doom is motivational for me as one example.
Sometimes I'll take a long'ish break (weeks) and teach myself something new just purely for fun. Experiment with something, that may or may not relate to the project. I divert my brain to an enjoyable stretch of time, a vacation, to prepare it for the final forced crunch of work.
I recently blew off a month and did almost nothing, when I could have completed what I'm working on. I got to the 85% finished line and hit hard resistance mentally. Some of that is feeling exhausted (it can feel like it sneaks up on you all at once), a lot of it is arriving at a large batch of work that I really don't enjoy doing. Combine those two and your brain puts on a yellow vest and begins protesting the longer you persist.
I've found that after taking a break, controlled anger is extremely effective as a helper for a final push over the line. That is, getting pissed off about the situation of having allowed myself to lose momentum and burn time rather than finishing something that is ~85-90% done and could have already been completed if I had simply maintained a steady momentum. I direct that anger in a focused manner as a big punch at the project that puts me over the remaining hurdle/s. It gets me into a mindset where I can just grit my teeth and dig through whatever shit I have to get done. Then the final 2-3% is usually just basic clean-up on loose ends or polish, truly trivial work.
Some might suggest that anger is always a negative. I strongly disagree with that. I think it's highly useful when channeled properly (never at others, and never in a serious self-harm form) and so long as it's not a common occurance during a project. It's critical to differentiate between using anger to overcome a self-challenge you're certain that you want to overcome, versus working on something you don't actually want to do. And to be clear, I'm not talking about rage or anything so dramatic. Rather, an internal expression of: damnit, fuck this, I'm going to finish it and nothing is going to stop me (except in my head it's all capitalized).
I always try to remind myself that the thing I'm building, I really, really want to see it live. I want to see it exist in the world, to see other people get value out of it. I set out on the journey for a reason.