How do AI algorithms learn and improve over time?

Have you ever wondered how your phone seems to know what you will type next. Or how a streaming service suggests a movie you end up loving…