YouTube is a master of getting you to watch videos you didn’t know existed minutes earlier.

On an average day, people around the world watch one billion hours of video on YouTube. Most of those—70%—are recommended by YouTube’s algorithms, chief product officer Neal Mohan revealed at CES, as reported by CNET. The recommendations keep mobile users watching for more than 60 minutes at a time, on average, he said.

The recommendations are personalized, and they’re the first thing you see when you sign onto the site or YouTube app. They help you find the needle in the haystack of the millions of videos on YouTube that you actually want to watch. And they follow you around the platform, making tailored suggestions based on what you’re searching for or watching—or even where you’re watching at the time. YouTube recommends shorter videos when you’re on the mobile app, and longer videos when you’re using the TV app, for example, The Verge previously reported.

The recommendations are fueled by the artificial-intelligence arm, Google Brain, of YouTube’s parent company. The machine-learning models help identify videos that aren’t exactly what you just watched, but similar enough that you might like them. If you’re watching a Taylor Swift music video, for instance, you might not want to watch every Swift video ever made, but you might enjoy videos from similar artists.

The algorithms make those connections by narrowing down the millions of videos on the platform into a more manageable pool of hundreds that might interest you, then ranking those videos based on how likely you are to watch them, Google engineers outlined in a 2016 paper (pdf).

For that first step, the system looks at things like the videos you recently searched for and watched, how long you spent watching them, what you told YouTube you liked and disliked with the thumbs up and thumbs down icons, and your demographics, such as a your gender, age, and the state you’re logged in from (if you’re logged in), as well as factors like how old the video is and users’s natural viewing patterns. Audiences normally watch episodes of series in sequential order, for instance. The algorithms make suggestions based on what other users with similar tastes are watching, too.

Once YouTube has a pool of hundreds of recommendations, the algorithms score those based on factors like whether you’ve watched a video from that channel or topic before, and recommend the highest scoring videos. The system learns from what you don’t watch, too. If you don’t watch a video that was recently recommended, it will be demoted when you reload the page.

YouTube recommends 200 million different videos to users, in 76 different languages, each day, The Verge reported. And the algorithms are constantly evolving to get smarter, manage the more than 400 hours of videos that are uploaded to YouTube each minute, and account for changes in viewing habits, like watching on mobile versus TV.