Foreshadowing is a literary device where an author reveals plot outcomes that develop through the course of the story. The vague advanced notions of the story are meant to arouse a reader's curiosity. For example, in Shakespeare's Macbeth, the witches not only tell Macbeth that he will be king, but provide the only way in which he can be killed: by a man not born of a woman. In the end, Macduff reveals that he was ripped from his mother's womb (Caesarian section) and is able to kill Macbeth.
Many writers prefer to use some sort of symbolism when foreshadowing a novel. In A Farewell to Arms, by Ernest Hemingway, the opening line that the leaves fell early is a symbolic foreshadowing of an early death of one of the major characters. Often, a the presence of a gun in literature or a film is highly symbolic foreshadowing of impending death. Foreshadowing is meant to set up the ending of a story, not reveal it entirely. The device is generally used to build dramatic tension within a work of fiction.
Foreshadowing can also be used in nonfiction writing. Placing key details about a main point can increase both the readability of a piece, but help to increase the impact of a conclusion. Often, nonfiction works will be written in the present tense, and provide key future details with specific language that indicates the direction that events will unfold. When used correctly, foreshadowing enlivens writing.