Your hard drive failing is one of the worst things that can happen to your computer, since you lose a ton of data. Fortunately, most drives include a tool set called SMART that can monitor your drive and let you know when you're about to have a problem.
As the video above from Techquickie explains, SMART monitors all kinds of details about your hard drive including its temperature, vibration levels, bad sectors and write cycles (for SSDs). With this data, it can give you an early warning when your hard drive might fail.
However, you have to seek out SMART to use it. The feature is kind of like the diagnostic computer in your car. Your PC doesn't just come with an app to show you all of that data. There are a couple of ways to access it, though. First, you can use a command prompt. Run the following two commands to see if there are any errors:
diskdrive get status
If this returns "OK" then your hard drive at least isn't suffering from critical errors. If it returns something else, you might have a problem. You can also use tools like Passmark DiskCheckup to go into more detail and find out exactly how healthy your hard drive is.
SMART for HDDs/SSDs as Fast As Possible [Techquickie]