Your computer's hard drive can fail for any of several reasons. If you have not backed up your files, you might have lost them permanently. In the case of a thesis for example, this can be a very frustrating event.
Preferably you back up your files by copying them to one or more external hard drives, although even copying to a USB drive is better than nothing.
You can also make use of a cloud storage service (e.g. OneDrive, Google Drive) to keep a copy of your files, which additionally allows easy access to the files from different devices. For example, your lasted compiled PDF is then accessible on your phone by using the cloud storage service's app. That allows for more easy sharing.
For large projects, the most professional solution is to also use source control, where each time you have made some progress you create a sort of checkpoint, allowing you to see what has changed at each moment of time. If suddenly there are compilation errors, you can see what has changed or revert to the previous version. With GitHub, you can create such a source control based on Git, synchronizing it to the GitHub servers.