In his book How to Become a Straight-A Student Cal Newport writes:
Next, try to solve the problem in the most obvious way possible. This, of course, probably won't work, because most difficult problems are tricky by nature. By failing in this initial approach, however, you will have at least identified what makes this problem hard. Now you are ready to try to come up with a real solution.
The next step is counterintuitive. After you've primed the problem, put away your notes and move on to something else. Instead of trying to force a solution, think about the problem in between other activities. As you walk across campus, wait in line at the dining hall, or take a shower, bring up the problem in your head and start thinking through solutions. You might even want to go on a quiet hike or long car ride dedicated entirely to mulling over the question at hand.
More often than not, after enough mobile consideration, you will finally stumble across a solution. Only then should you schedule more time to go back to the problem set, write it down formally, and work out the kinks. It's unclear exactly why solving problems is easier when you're on the go, but, whatever the explanation, it has worked for many students. Even better, it saves a lot of time, since most of your thinking has been done in little interludes between other activities, not during big blocks of valuable free time.
In her book A Mind for Numbers, Barbara Oakley distinguishes between "focused mode" and "diffuse mode".