In a nutshell
A language model does one thing over and over: given the text so far, it produces a probability for every possible next token — a tiny chunk of text, roughly a word or word-piece — and those probabilities add up to 1. It picks one, appends it, and repeats, so a whole paragraph is just that one prediction run again and again. Training shows it mountains of real text and tunes it to give high probability to the word that actually came next; the better it gets, the lower its perplexity.