@GoldenGlovez has gotten it pretty much right.
Although, most people that do it now have no idea what they're doing.
I call it the trailer/teaser method.
So historical analytical data has shown that the first 5, 15 and 30 seconds of a video matter, when it comes to audience retention.
It's also well known that all three - YouTube, Tiktok and Meta use these engagement metrics to optimize their algorithms.
This "technique" predates the social video age though.
Movies have had trailers/teasers since forevers. Telenovelas and Daily soaps often teased the upcoming episode at the end of the current episode.
Even news channel specialist programs (that are pre-recorded) have an "In Today's Episode" segment at the start showcasing guests, a couple jokes or antics from the program.
All of this translated to YouTube (and others).
My best guess is this started with travel channels that began displaying an "In this video" and they'd show bits and pieces of the areas they covered - food platters, people, mountains, rivers, beaches or whatever else.
The idea was to awe the audience so that they'd stick around to see the same place in more detail.
This then began getting carried on to other channels. They brought along their niche specific nuances and it doesn't always translate well.