There are several ways of building tension and making a reader keep flipping pages. Like everything, though, it's a balance. Too many mysteries without enough answers, and most readers will throw up their hands and walk away. For instance, if you ask a lot of viewers who never finished watching Lost why they stopped watching, it was because there were too many mysteries and not enough answers, for their tastes. Not enough tension or readers aren't invested, and you've just as effectively lost their desire to find out what happens next. Ask any high school student forced to read something that plods by modern standards, and you'll see lots of eye-rolling, that they don't care what happens, and complaints that it's boring.
How does a writer strike a balance? Well, here's what I focus on:
The characters have something to lose. A deadly challenge is the most extreme example, but there are ways characters can suffer without dying. Often the main character will fear losing someone or something precious, being stripped of power, discovery, exile, or poverty. These are most common in first-person narratives, where we're assured by virtue of the person surviving long enough to tell the tale that the main character survives. Failure of the task plunked down by the narrative often isn't enough, which leads me to:
The characters are personally invested. Whatever's at stake must be established as something important. Obviously, if you're talking about putting a person's life at stake in the narrative, it won't be much of a stretch for the reader to understand why the character wants to keep it. But why should the reader care that this fictional person survives? This leads directly into:
The reader is invested in the character. The reader must be able to relate, in some way, to the character's (or characters') motive for success, and avoidance of failure. I've already talked about relating to characters, so I'll just add that tension sags if you don't relate to anyone in the narrative, and that readers are more invested if they're cheering for someone, instead of passively watching the story go by.
Information is withheld. I like it when I ask a question of the narrative that isn't answered until the second-to-last page (or, in a series, in the final book). I like rereading books where I've had an "A-ha!" moment, so I can see where the writer dropped hints. I like wondering, speculating, and discovering new things about the book. Little can keep me reading more avidly than that I have to know if a question is answered by the end. Little will satisfy me more about a read than that my obscure observation paid off.
I love writing that stuff in, too. I cackle like a mad scientist over what I know that the reader won't, and imagine reactions as they get to the payoff. My characters are a tight-lipped bunch who take the "show, don't tell" rule seriously, and so I get to hint and dance around reveals until my characters get around to discovering them. It's as much fun as I have in rewrites. That sounds sadder than it is, I swear.
Writing foreshadowing is a post for another time, I think.
So, what have I forgotten in the above? What do you notice in the books that keep you turning pages? How do you write tension in your works? Feel free to weigh in.
Oh yeah, and: pation.