To the extent that we can give a brief answer to the question of where novel ideas come from, it's curiosity. That's what people are usually feeling before having them.
So the lesson there is... look for any sort of excuse, however silly or arbitrary, to make anything at all. Because everything we do tends to leave some traces of everything that we are.
Is there a way to cultivate curiosity? To start with, you want to avoid situations that suppress it. How much does the work you're currently doing engage your curiosity? If the answer is "not much," maybe you should change something.