Hinting at something that’s coming. We see this most commonly in TV detective drama. The ’twist’ ending only works if you’ve already met the perp in a minor role. My wife and I enjoy playing spot-the-unnecessary-minor-character.
Foreshadowing is typified by the famous Chekhov quote:
“If there’s a gun on the wall in act one, scene one, you must fire the gun by act three, scene two. If you fire a gun in act three, scene two, you must see the gun on the wall in act one, scene one.” — Anton Chekhov