According to Harvard Business Review new research indicates taking a break can be a crucial step to having more ideas.
A possible explanation for is that when you work on a problem continuously, you can become fixated on previous solutions. By taking a break from the problem and focusing on something else entirely you give your mind some time to release its fixation on the same solutions and let the old pathways fade from memory. Then, when you return to the original problem, your mind is more open to new possibilities.
So the next time you find yourself struggling with a project, work on something else and clear your mind for your project when you return to it.