There is a strange phenomenon which occurs when one undertakes a creative task: the lower the probability of short-term success, the harder one tends to push.
Whether it be writing an essay, or coding up a complicated program module, when a local hurdle is reached - eg: a paragraph that doesn't sound right after 10 revisions - there's an inexplicable compulsion to believe that "I'm almost there....almost....almost..............."
I think this is in fact the conscious mind operating at its maximum capacity. It tries to fit together some part of the whole, but has to drop information of the rest while processing the current focus. After some bout of intense concentration, this local issue gets resolved, which is exhilarating, giving one a sense of flow. That is, until the conscious mind pulls out a piece of the previously forgotten whole, only to discover new problems in yet another "almost there" cycle.
The solution is to back off, let your subconscious process the swarm of inputs into something comprehendible, and come back at a later time to fetch the output. This separating of the conceptual and the contextual work, is the true key to keeping the creative juices flowing. Abuse it.