Foreshadowing is a literary device used by authors to hint at future events or developments in a story. It creates suspense and builds anticipation by providing clues or subtle hints about what is to come, allowing readers to make predictions and engage more deeply with the narrative.