We'll cover all you need to know in this article, from old school ways to retrieve keys, to the more modern approaches to make good use of your licenses and what restrictions may apply depending on your type of license. Microsoft has been changing and improving the way it handles Windows licenses.
In other instances, for example if you built and installed your OS, your key is associated with your Microsoft account, so there is no way to 'lose it' anymore. But in recent years manufacturers started storing this license within the machine's UEFI/BIOS and the information is automatically retrieved and applied when reinstalling the operating system. In brief For the longest time Windows PCs came with a product key sticker that was placed outside of the machine or with your computer's manuals.