I always try to analyze why I'm struggling to write so that I can deal with the root problem. Often, I find that my problems stem from a lack of knowledge about my subject. I find that specific research on some element of the scene I'm writing helps me focus, gives me a clearer idea of what I can and can't include in the scene, and sometimes even gives me ideas of new ways to take the story.
When research isn't the answer, I usually take a short break from my writing to recharge my emotional batteries. Whether it's going for a walk, playing a game, reading, or hanging out with friends and family, I find that stepping away from the problem is more effective than chaining myself to my computer until I get through it. Of course, the key is to come back to the writing later, but usually the flood of ideas that I get is enough motivation to bring me back.