I don't think it's so much about motivation as having a structure to your work that allows you to get shit done. I think motivation follows hard work and seeing results, it rarely precedes it. Attention from the press or social media or stuff like that can also briefly be motivating, but it wanes very quickly and is not very reliable.
It's helped to make notes of my ideas as they come. I have literally a wall of post-its that say something like "LSH", or "middle platonism is processed weirdly", or "34 bit URL ids" or "refactor query variants ASAP". It's not prioritized like a backlog, but just a jumble of ideas I've had about what to do next while working on something. It's been pretty helpful to essentially have a work pool to pull tasks from.
My project naturally has 2 month "iterations" because that's how often I do a new crawl and load crawl data, which permits breaking changes in the underlying data structure. So I'll just pull improvements from my wall and try to distribute the work evenly so it progresses in a meaningful sense.