Clever film-making is built on a number of pillars for success: you need great characters, intelligent, satisfying story development, entertainment and some sort of emotional truth in there. In other words, you need things that grip your audience and keep them there for the two hours or so it takes to spin your yarn.
That's why there are so many story-telling tools that writers and directors employ to capture the imaginations of their viewers. And it goes without saying that part of that art involves trickery and a little black magic. Some of the greatest ever films use twists, Red Herrings, embedded foreshadowing and downright cheating to achieve their goals. And while you'd think that being made to feel a fool in the service of a story pay-off wouldn't be particularly satisfying, there's a reason it happens time and time again.
And one of the smartest tricks that can be played happens when a film-maker sets out to foreshadow particular events happening, only to pull the rug out from under you with an entirely different resolution. The old Red Herring switcheroo...
In the original Star Wars trilogy includes Han Solo getting the feeling that he's never going to see the Millennium Falcon again. It's basically a giant red flag that Han is about to be killed off, probably because he actually WAS going to be killed off at one point in the early planning stages.
It helped the scam that Solo's "bad feelings" tended to be spot-on - like he had some sort of built-in precognitive ability - so it was impossible not to suspect he might be right about his own fate.
What Actually Happened...
Han DID see the Millennium Falcon again because he wasn't killed off. He even lived long enough to lose the ship again and refind it in The Force Awakens, at which point the foreshadowing grew too strong for even him and his happiness at being "home" - a surefire Deadmeat signaller - led to his spectacular demise at the hands of his own son.