Foreshadowing or guessing ahead is a literary device by which an author hints what is to come. It is used to avoid disappointment, and sometimes used to arouse readers.
Example
Foreshadowing is used in the works of John Steinbeck. In Of Mice and Men, Lennieaccidentally kills a mouse, a puppy dog and finally Curley's Wife. This foreshadows his own death. When Carlson kills Candy's Dog, Candy told George, "I ought to of shot that dog myself" making George later chose to kill Lennie himself to save him from dying by the hands of a stranger. Doing it the way that Carlson did it was for the best because, "He won't even feel it."
References
↑Mogensen (2009). Along Literary Lines. Gyldendal. p.55. ISBN8702056178.