I'm just wondering how they work, because it doesn't seem like they are sending any data to the OS.
They are sending data, but they may not be sending 'keyboard' data.
As I'm sure you know, USB supports many different kinds of device (disks, scanners, printers, etc.) and in particular different kinds of input device, besides keyboards — mice, joysticks, tablets, and so on.
And you're probably aware of combination devices, e.g. a keyboard with a built-in trackpad or trackpoint. With USB, media buttons are like a separate device built in with the keyboard. They use what USB calls the "Consumer Page", with a different set of codes from the "Keyboard Page". The OS sees them, but not as regular keystrokes.
(There is potentially some overlap; there are actually keyboard codes for volume and mute (but not things like play/pause or application launch buttons), and there are Consumer Page codes for some things that have traditional keyboard codes, like copy/paste. USB input is a big complicated mess.)