First, you need to provide us the model so we can be more acurate.
Second, "youtube" search your model for HDD replacement 😀. I dont know the steps for relicensing your Windows 8,1, considering that, i presume you did not get a DVD with a key on it and it came preinstalled on your laptop (usually there are recovery partitions for windows on the HDD, so, if you replace your HDD i dont know how you should proceed)