One of my favorite things about TV shows and novels with intricate storylines or novel series is the foreshadowing, especially when it's done well where there were hints when you least expected them and you pick up on them rewatching and/or rereading the whole story (see Avatar:TLA or any Tokusatsu works with Yasuko Kobayashi heavily involved like Timeranger, Kamen Rider Ryuki, etc).
I'd like to know others think about it and how one can handle this effectively, especially if a story were to be (hypothetically) subjected to changes.
In addition, how does one manage to hide the truth in plain sight until it's finally revealed (and everyone slaps themselves on the head, telling themselves that they should've known)?
I've done this a bit with my main fic (now long finished :V), but some of that foreshadowing was more towards the XD games more than the plot within the story, so maybe there's some cheating on my part there, so to speak. =p
I think a good way to go about it is to apply the foreshadowing touches as you go, or even when the story basis is finished (which is more useful for those people who write the fic out first and then post, or oneshots). It's easier to see how you can hint towards an event or plot twist or the likes when you've already written it out. Brainstorming helps too - just doing point forms or the like of the events can help you organise that sort of detail.
Foreshadowing requires a lot of organization. First you need to understand what you are going for in the first place -- what is it that's so big that I want to conk over the reader's head? Then take that main thing apart: What are the objects or instances in this event that you can take apart and put into the story? Is it the character's true intention showing through in the end, or a certain object that holds valuable importance, or a massive cataclysm that will completely change the story?
When you have found what everything breaks down into, then you should take those pieces and figure out where in the story you want them to go in. Decide how you want these pieces to influence the characters -- is it a subtle glimpse they catch, or are they completely oblivious to it the entire time? Are they fully aware of it, forebode it, even? How does this effect the rest of the layout, between the characters and the story?
What usually matters most about foreshadowing is the impact. You can either make it hit hard, but the reader has no idea what it is about it that is so big, or you can make it so subtle that only second-timers will catch it. Simple foreshadowing would be along the lines of, "The glint of a dagger glinted between the twitchy fingers of the infiltrator." More complex would be along the lines of "The Hitchhiker's Guide to the Galaxy" where the narrator often pointed to the fact that humans were only the third most intelligent life forms, and continued pushing forward the idea with more and more information bit by bit, until it was finally revealed as to what it was. Of course, where and at what intervals you put this information is up to you, and depends upon how much information you have and want to clue in to.