Restoring a hardware wallet
The 12, 18, or 24 word mnemonic that you have (colloquially referred to as the seed) is a BIP 39 mnemonic. This encodes a 256 bit number which is then used to derive the private keys in your wallet.

All of the private keys in your wallet are derived using the method described in BIP 32. This allows for private keys to be derived from a fixed seed (which is encoded by your BIP 39 mnemonic) and to be done so deterministically, i.e. the same keys are always derived.

So when you restore a hardware wallet or any other wallet that supports BIP 39 and BIP 32, you are really just setting a fixed seed which is then later used to derive all of your private keys.