If you upgrade to Windows 10 during the initial free upgrade period and then choose to format your system after the free upgrade deadline, your Windows 10 license will still be valid. Once you activate Windows 10 on your device during the free upgrade period, Microsoft will make a record of your hardware configuration and associate your system with a digital entitlement for Windows 10.
Even if you format your system after the free upgrade expiration, you should be able to reinstall Windows 10 and use the same digital entitlement to reactivate it on that device. The activation servers at Microsoft recognize your device and its entitlement status based on previous activations, allowing you to reinstall and activate Windows 10 on the same...