system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How do master keys work?
gpt
Inside a lock there is a barrel, the barrel is filled with rods of different lengths.

The bumps on your key raise the rods so that their ends are perfectly lined up with the edge of the barrel, so it can turn.

Each lock has a different combination of rod lengths so that the lock matches up only to its key. 

In a lock that can be opened by a master key, the rods are in two pieces. The owners key will raise the entire rod to be clear of the barrel, but the master key can raise the rods so that the lower piece is still in the barrel, but the edge of the barrel lines up with the division that splits the rod in two. So now the lock can be opened by two different keys.

So just make all the keys in a building like that, so that the divisions in their rods all get lined up by one key, but the full rods still have unique combinations of lengths.

Done.