Im not entirely sure the specifics of how it works. But lets say its a Dell PC. That CD key to activate windows will be a OEM key, and the Bios has a SLIC table tied to it to verify its authenticity.
if the key matches the bios, then it will activate.
As far as I am aware, the Hard Drive itself should have no impact.
As far as a restore Image, it will depend on the manufacturer. Some allow you to create a DVD of the system image. Which restore the PC to a state as it was when you first purchases it.
Some have a hidden partition on the HD.
You will need to check with the manufacturer for more details how they do it though.
Although, someone here at the forums may know more in this regard.