You can prime yourself to be receptive to ideas. Stimulus can come from anywhere, the more varied the better. If you always focus in the same place you limit the material you prime your mind with. See the bigger picture and sometimes the solution is obvious.
To have a good idea you have to:
1. Have a firm understanding of the problem in hand
2. know what you are looking for
3. look in lots of places for a solution
4. take time away from the problem
5. consider options that others reject
6. discard things along the way
7. keep going
8. Spend some times thinking about a problem, on your own and talking with friends and colleagues. Then do something else. Something may well occur whilst you are doing something else.
9. Keep ideas flowing. The more you produce the more likely it is the right one will come along.