How does a wallet rebuild itself from its seed? How does it identify the addresses and transactions on the blockchain in order to rebuild the history of that wallet?
If by seed you are referring to a mnemonic phrase (12 or 24 words is common) then the process goes something like this:


The phrase is hashed (or some other process) to produce random or pseudorandom bytes we will call the "seed"
The byte array seed is passed into BIP32 HD master key algorithm to create a BIP32 master key.
Following a standard like BIP44, the wallet then derives sub-keys sequentially in order. Checking for transaction history of each key's output.
If left alone, this loop would last forever, so standards like BIP44 specify a "gap limit" which means that if gap limit = 20, then "If I generate 20 addresses in a row that all have 0 transactions in their history, I will stop checking addresses" For receiving paths, 20 seems common, for change paths 1 is standard.


Continue this loop until the gap limit is reached.

This type of methodology doesn't work for merchants or large exchanges, so the gap limit logic of "how far do we keep checking" may vary.

But most HD wallets rebuild themselves in this way.