Sometimes I get an idea and I lose it before I can write it down. I often make the mistake of thinking that it will simply come back to me. It randomly came to me once, so it should come back again, I rationalize. But that's not how it actually works.
Thoughts are not random. They all have a stimulus. Something you did or saw sparked a thought that triggered several more, which led to your idea. Even if you weren't struggling to come up with the idea, something sprang that idea into existence.
If you want an idea, you cannot sit around and wait for it to come. I've learned that the hard way - it just doesn't happen. You have to do something. Do something thought-provoking; that's how you provoke thoughts! Whether it's hanging with people, talking, walking around by yourself, or roller-blading, whatever gets those wheels turning is the best way to get ideas.
Although a lot of things seem to just sorta happen, they all take effort. Put some effort into your endeavors and you will get some results.