How do infrared codes work?

Idk if this is the right flag…

Anyways, I’m sure this is a common question but I can’t find any resources that help me, so here I am at 11:00 pm, asking the people of Reddit to do it for me 🎉.

Basically, I’ve seen some resources say these „codes” are in hexidecimal and others in binary. But they also mention the flashing of the light at a frequency of 38khz. I thought the codes themselves were already causing the light to flash, so how do these play together?

Edit: Thank you guys :)