What should I do to avoid hdd failures?
Solution 1:
First suggestion, control heat and air-flow past the drives. No dust-bunnies.
Second, for some hard-core statistical investigation into drive failure causes, you can't do better than Google: https://static.googleusercontent.com/media/research.google.com/en//archive/disk_failures.pdf (It is a bit dry, but if you want likely causes, they have done all of the hard work)
Third, purchase drives with a long warranty. Manufacturers choose warranty periods that make them money. This will cost you more initially, but you may well get some reliability out of it.
Fourth, if you get frequent disk failures, use a redundant storage system so that you can tolerate failures. RAID1 doesn't prevent failures, it makes it so that you can tolerate them when they inevitably happen.
Fifth, if you get frequent disk failures, backup. A lot. If you think you're doing too many backups, consider how much it costs you in time and effort to recover from a disk failure, and compare that to the time and effort you are putting into backups. Then do another backup.
Solution 2:
Disks very rarely fail simply from a lot of use.
Check your PSU, if you regularly lose HDs then this is often the cause.