The flow of ideas will come and go. There will be ups and downs and dry spells. Over time, you learn to step back at just the right moment to give your brain a rest.
You aren't stopping your work necessarily, but rather letting the ideas simmer in the back of your mind. The solution will emerge in time.
It may not be perfect or fully formed, but enough to get you to the next step.
The more you flex your mind by working to generate ideas, the more efficient and effective your mind becomes at processing the right answer to your problem. It's not easy at first to walk away from your desk with a looming deadline, but a break at the right moment can help push you through to the other side.
How do I keep track of what I'm doing? Keeping notes, primarily.
Like a gardener attending just-planted seeds, I know that when the conditions are right the ideas will transform into something real. The other part of taking breaks is understanding that you need to create the right environment for the ideas and solutions to emerge.
Over time, I have learned that a quick walk in the middle of my deep work is often just enough to set an idea free. As a side note, coffee is good for production mode, but not necessarily for relaxing your mind to let things flow.