My understanding is you basically just bash your head against the problem for long enough, and simultaneously have enough of a grounding in the fundamentals, that you just start to come up with it as the obvious next thing. In other words, there's no trick to it, just expertise, hard work, and an eye for what's relevant and what's irrelevant in the problem.