Scientific progress does not always go "Boink". Instead, it frequently goes "muttermuttermutter@!$%&*mutter". The thing about science is that, well, when you're trying to figure out something new, no one can tell you the answer. There's no hint in the back of the book, or 24-hour help line. So, if you get stuck, you may well find yourself in the scientific equivalent of a lonely mountain road with a broken axle. And no cell service. In essence, you've broken down in a place no one wants to go to. But, unless you're ready to call it quits, you somehow have to find your way out. You don't know how long it's going to take, or how you're going to make it, but somehow, you're going to find your way back to the main road. So, you keep hurling yourself at the problem, trying every MacGyver trick in your arsenal, hoping that something, anything, will work. The thing about these periods is that while they're about the single most frustrating and unrewarding part of the scientific process, they are also a ridiculously effective way to develop new skills. By the time you've tried 5 different methods of fitting a straight line to some data points, you've picked up a heck of a lot about statistics (or, in my case, about solving a network of partial differential equations where the time dependence of three quantities depends on the spatial variation of 1 or more of the others. Ick.). The good news is that as you get older, you spend less and less time in such states, because you've got an enormous swiss army knife of tools that you carry around in your back pocket. ("Hmmm, broken axle? I recognize that particular brand of axle from Abromowitz & Stegun, and I believe I might happen to have some IDL code right here that can fix it...") The bad news is that you can forget how much those periods, well, suck.
(Unsolicited but Related Advice for Junior Scientists: When giving talks, avoid dwelling on the Doldrums, even if you spent 90% of the project drifting around them. Focus on the science, even if it was only a small fraction of your research effort.)