I find it very helpful, in addition to the advice provided by Adam Tester, to keep a small running record of events. The way I like to do it is something of a mix between a simple event log and a journal, where I record both the actions I've taken and my attitude about them. I combine this with my running to-do list.
For example, let's say I'm working on a personal website. My to-do list might look like this:
1. (done) Register domain name
2. (done) create index.html
3. create 'about me' page
4. add CSS to site
Meanwhile, I have a log that looks like this:
2012-07-01: Decided to make a personal website. Registered the domain "allaboutme.com"
2012-07-02: Created index.html for the website. It doesn't look very attractive right now, I need to add styles.
I keep up a simple log like this, and it makes it much easier to jump into the mindset I was in when I stopped working the day before. I can read the past few days' entries and have a very good refresher on what I thought was important, and either follow through with that or re-think the decision now that I've slept on it.
You can use any format you like for your to-do list and the log. Plain text files will work well enough for both, or pen and paper, or more involved tools. Personally, I use taskwarrior for my to-do and vimwiki for my log, which I love.
I know you are probably more concerned with the motivation piece than with the tools. That eagerness that grips you when you get a good idea can be very hard to recapture. To my knowledge, there's no magic solution to getting it back. The best you can do, I've found, is to leave yourself helpful reminders so that recalling the state becomes easier.