Videos don’t make great answers on this site, but I nevertheless recommend How does n–key rollover work? by Ben Eater. He demonstrates the differences between a cheap keyboard with 2–key rollover and a good keyboard with n–key rollover, describes how the circuitry in these keyboards work to show what the cheap keyboard is missing, and captures actual USB setup and data packets from the keyboards to show exactly how they communicate with the host computer.
You can compare this with his earlier video So how does a PS/2 keyboard interface work? to see the differences between the USB and PS/2 protocols. He’s also got a couple of videos where he writes the software for a 6502–based computer to convert these key events into text.
What is most interesting about the PS/2 protocol is that nothing needs to change to accommodate n–key rollover, but only because it pushes a lot of the work onto the computer itself. The computer must have a buffer large enough to hold at least one key press event from each key on the keyboard, or it needs to translate those key press events into a bitmap of keys that are currently being pressed. On USB keyboards, the keyboard itself must maintain that buffer or bitmap. That buffer traditionally has room for six keys (though in principle it could be any length), which is long enough to satisfy most users, but not to support true n–key rollover. Some keyboards with less than 6–key rollover nevertheless have a USB chip with a six key buffer.
As an aside, the operating system on your computer delivers key–press and key–release events to the programs you are running, almost exactly like the PS/2 protocol delivers, so it must convert the buffer into six to twelve events. Likewise the bitmap could end up getting converted into more than a hundred events. Game engines frequently convert these events back into a bitmap of keys that are pressed¹ for the game to examine.
It’s basically clown shoes.
¹ Or sometimes a larger bitmap that indicates which keys started being pressed this frame, keys that have been pressed for multiple frames, and keys that were released this frame.