Foreshadowing is a writing technique. The author will provide clues throughout the story so that a reader may be able to predict something that happens. This can be obvious or subtle. Sometimes, they are not evident until the 2nd time you read something. Since you already know the outcome, it can be easier to see obscur hints in the story and then you have an "ah ha" moment.