Your motherboard and its components primarily (NIC, CPU, etc), and then I think things like your RAM, video card, and so on. It takes all of these parts and generates a unique identifier for your PC. You can usually change several components without any problems, like a new hard drive or video card. With XP through 8 changing your motherboard or too many other components would cause you to have to reactivate; sometimes you would have to do so by phone. I'm not sure yet how it will work with Windows 10 as far as upgrading components goes.
You won't need a key to reinstall or do a clean install. As I understand it Windows 10 creates a unique hash for your hardware during the upgrade and stores it online. The next time you install Windows 10 on that hardware it will look up this info, recognize your machine and install without any need for keys.