Hi there,
If it is an OEM key and digitally linked then you can just clean install and then it will be reactivated without any action from you. If it is retail and you have the key, just select the change product key and input your Key.
Here is a link for a detailed description of the process that you must follow.
Reactivating Windows after a hardware change
https://support.microsoft.com/en-us/windows/reactivating-windows-after-a-hardware-change-2c0e962a-f04c-145b-6ead-fb3fc72b6665
--If the reply is helpful, please Upvote and Accept it as an answer--