You should read Margaret Boden's The Creative Mind, which analyses all the ingredients necessary for the human mind to generate creative ideas. Like with everything, it's a skill you can learn and practice, once you know how the creative process works in your brain.