There are two things I do. One is to put whatever's got me blocked on a mental bookshelf, and just let it be. Usually the solution will come to me seemingly out of the blue, at some random moment. But, importantly, the answer always does come.
Another thing is to simply keep writing, skip whatever's got you blocked, write some other part of the story. Even if what you're writing at that moment isn't very good because you can't really think, the mechanical nature of physically writing I think helps break up the blockage (actual pen and paper helps).