I just learned this the hard way, as I’m working on ribbing too (for the first time).
My project has an odd number of stitches, 65. So my first row ends with a knit stitch. But the second row does not start with a knit stitch…you start with purl. This is because the last row ended with a knit, and you just keep on going in pattern (k1, p1) even at the end of the row. Kind of like writing a sentence and moving down to the next line.
Plus, as Merigold said, learn the whole “knit the knits and purl the purls” thing, it will make much more sense! So because the last row ended with a knit, when you turn it over, that stitch now looks like a purl, and you purl the purls.