In my writing posts, I'm currently talking about getting through the hard parts of writing a book, when it would be easy to give up, either due to something in the book itself or something outside the story.
This time, I'll get into the trickiest one of all, when you're stuck -- when you either don't know what should happen next or don't know how it should happen. Either way, you just can't seem to go on from where you are. It's easy at this point to decide that the book just isn't working and give up. This is also when other ideas start looking very tempting and when outside distractions become more powerful. Anything else starts to seem more interesting to you than the book you're trying to write.
This is definitely a case of "been there, done that" for me, so here are some tactics I've found that have helped:
One thing to do is go back and re-read what you've written, either from the beginning or at least a few chapters before the point where you're stuck. That helps put it into the perspective of a reader. It's easy to forget that a reader will go through in an hour or two the pages you've slaved over for weeks or even months. Seeing how the book leads up to where you are may give you the momentum and inspiration to pick up and keep going. You may also notice plot threads that you've set up or character arcs you've built without even realizing it. That may give you ideas for what to do next.
After you read, step away to give yourself time to process it and think about it. There's been research showing that physical activity helps spur creativity, so get some exercise. Go for a walk, go dancing, do some gardening, hit the gym. That may help spark some ideas. Research has also shown that doing something that requires some concentration is good for helping you work out problems. Play a musical instrument, do some kind of craft that requires thinking, sort documents, do anything that forces you not to think about about your book. While you're not thinking about it, the problem may be sorting itself out in your subconscious.
If you have an outline, review it. If you don't, try making an outline, figuring out the major turning points leading to the ending and then filling in incidents. If you have an idea of how the book should end, try reverse engineering to think of what needs to happen to bring about that ending. Or if you don't know the ending, work backward from what you do know.
Think about your characters' goals. What do they want to accomplish in your story? What steps should they take to reach their goals? What might get in their way? What was the last thing your protagonist tried? How did it work out? What's the next thing he or she should try in the aftermath of the last attempt? What's the last thing the villain tried, how did it work out, and what's the logical next step?
Make a list of things that could happen next, or if you know what happens next but not how it should happen, then a list of how it could happen. Try to be as specific as possible, and fill at least an entire sheet of paper. You may have to get kind of crazy and silly to fill an entire sheet, but don't stop even if you come up with a solution you think you like. You may find a few ideas you like in the list. Then take a few of the best ideas and explore them more thoroughly. By this time, a scene may start shaping up in your mind. Two or three ideas may come together.
It may help to talk to someone about your story and the problem you're facing. A friend with good story instincts may be helpful here if he or she can ask good questions, but I find that just the act of verbalizing it helps, so even talking to yourself may help.
If you have a scene in mind for later in the book, go ahead and write it. When you're utterly stuck, skip the part you're stuck on and write whatever comes to mind. That way you're still making progress, and writing those future scenes might give you ideas about what can come in between. You're exploring the characters and your situation, and if you're writing, you feel less stuck. If all else fails, write a scene you know won't be in the book, just a conversation between characters, and see what they say to each other. Let them talk about what they want to do, what they're afraid might happen. Then you might be able to create a scene in which those things do happen.
I find it helps sometimes to start a new document to make a stab at writing that next scene when I've finally got an idea for it. It feels less "real" then, which lowers the sense of pressure. I'm just playing, testing out ideas, rather than writing that all-important next scene in the book. When you've been stuck for a while, that next scene can take on impossible proportions, so convincing yourself that you're just playing with ideas may make it a little easier to face. If you have something you like, you can paste it into the whole book. If you don't like it, you can delete it and start over.
Remember that you can always revise what you've written. That next scene doesn't have to be perfect now. It just needs to move the story forward. You can go back and fix it later. You may even replace it entirely later. The important thing is to move forward and finish the book.