Foreshadowing is a "literary device in which a writer gives an advance hint of what is to come later in the story. Foreshadowing often appears at the beginning of a story, or a chapter, and it helps the reader develop expectations about the upcoming events.
A writer may implement foreshadowing in many different ways. Some of these ways include: character dialogues, plot events, and changes in setting. Even the title of a work or a chapter can act as a clue that suggests what is going to happen. Foreshadowing in fiction creates an atmosphere of suspense in a story, so that the readers are interested to know more.
This literary device is generally used is to build anticipation in the minds of readers about what might happen next, thus adding dramatic tension to a story. Moreover, foreshadowing can make extraordinary and bizarre events appear credible, as the events are predicted beforehand so that readers are mentally prepared for them. 
This literary device is frequently adapted for use by "composers of theatrical music, in the composition of "operas, "musicals, "radio, film, "television, "gaming, podcast, and internet scores and "underscores, and "incidental music for spoken theatrical productions.
Foreshadowing is often confused with other "literary techniques. Some of these techniques include:
By analogy to foreshadowing, the literary critic Gary Morson describes its opposite, sideshadowing. Found notably in the epic novels of "Leo Tolstoy and "Fyodor Dostoyevsky, it is the practice of including scenes that turn out to have no relevance to the plot. This, according to Morson, increases the verisimilitude of the fiction because the audience knows that in real life, unlike in novels, most events are in fact inconsequential. This "sense of structurelessness" invites the audience to "interpret and question the events that actually do come to pass".