Foreshadowing is the subtle art of suggesting or hinting at developments in plot, characterization, or setting that will happen later in the story. It’s a promise to the reader that the gun on the mantelpiece will go off eventually, that the main character will be forced to face his/her inner demons, that the seemingly-happy surface of the family or the town is either a sham or due to be disrupted in short order. It can range from the blatantly obvious (“Little did he know that he had less than an hour to live”) to the traditional (“It was a dark and stormy night…”) to the barely-visible (when the heroine scans the passers-by, is it the woman in the brown cloak who’s going to be significant later, or the man in the red vest? Or are they both just descriptive detail, adding artistic verisimilitude to an otherwise bald and unconvincing narrative, and not hinting at a reappearance at all?).
Dropping hints can be a tricky business; if the “hints” are too obvious, they telegraph future developments, which can remove both the suspense and the surprise (and often, the reader’s interest in continuing as well). If the hints are too obscure, the reader may not catch on at all, and then complain that things “come out of left field” and/or aren’t believable.
Authors use foreshadowing in order to increase tension or suspense, to set up later developments in character or plot so that they will be more believable, or to prepare the reader for future events in the story. Sometimes, the “foreshadowing” isn’t a conscious or deliberate choice on the part of the author at all; other times, it’s carefully planned from the get-go, or backfilled just as deliberately during revisions. It doesn’t matter when or how it gets in there, as long as it does the job.
What the job is, is a whole ‘nother question. There are so many possible things one can do with foreshadowing that it’s easy to get confused and try to do all of them at once. But foreshadowing is, above all, a promise to the reader that something interesting is going to come of this. If the writer doesn’t deliver on that promise, the reader loses trust.
For instance, the basic uses of foreshadowing are a) to make a future event or plot twist more plausible and believable, or b) to increase reader suspense, tension, or anticipation by pointing at important stuff that’s coming up. If an author heavily foreshadows an event that the reader already sees as plausible – say, the main character is going to stop at McDonalds on her way home from work – the reader will assume that the writer has a good reason for making a point of such an ordinary event. Consequently, the reader figures something interesting and plot-relevant is going to happen at that McDonalds (that is, since the foreshadowing is obviously not the “a” kind, it must be the “b” kind, pointing up something important).
If all that happens is that the character orders her burger and fries (no armed robbery in progress, no serial killer hiding behind the trash bins, no cheating spouse caught with their main squeeze), the reader is going to be disappointed. In the worst case – if the author has done a really good job of foreshadowing – the reader will spend the rest of the book wondering what the heck was so important about that visit to McDonalds, and when nothing ever comes of it, they’ll get cranky.
By the same token, the author can’t reasonably foreshadow every single thing that happens. For one thing, the novel would bloat up to an unreadable size. For another, plot twists and events are not equally important. If the author tries to give everything equal attention, the story flattens out into a tangle of subplots, with no one thread identifiable as the main plot, and the reader is likely to give up in confusion.
There are four basic techniques that are used to foreshadow upcoming events. The first is verbal, meaning, in dialog or internal monolog: the sensible character saying “We should stick together!” just before everyone splits up, the ranger warning the campers that there are snakes or bears in the area, the radio weather report suggesting storms. Next comes action, which covers everything from body language (a character whose hands shake and who breaks out in a sweat when his buddy suggests stopping at McDonalds, for instance) to screaming and running from a tiny spider.
Third is description – the proverbial gun on the mantelpiece, the three full bottles of aspirin in the medicine cabinet, the falling-apart jalopy that the reader can see is just ripe for a flat tire or breakdown. Last is a hard-to-describe category I call “authorial intervention,” meaning everything from direct statements by the narrator (“She didn’t suspect this would be the worst day of her life” “I shoulda known better than to trust a dame”) to things like prophecies and omens (because in most cases the black cat and the oracular pronouncement don’t arise from the cause-and-effect actions within the story; the author is the one who decided to have a prophecy or omen or symbolic storm at just exactly that right moment in the story).
A lot of people seem to consider authorial intervention to be “cheating,” so if you’re planning to use it in a story, you need to set it up with care and handle it delicately. Besides that caveat, there’s no reason to prefer one technique over another – which one to use depends on which one will get the job done smoothly in that particular story, without being either too subtle to see or hitting the reader over the head.