Unit tests enable you to meet the Apex code coverage requirements for deploying or packaging Apex. This action will run a unit test in your Salesforce. As a part of automation, you can set up to run a test repeatedly every hour, day or month, if needed.
While deployment if any of the test method fails then deployment can not happen. There could be various reasons for test method failure such as Data Dependency, New Validation Rule added in production, etc.
Sometimes we miss to add dependent components like we add the trigger but miss to add its helper class or common utility class used in it.
Sometimes we miss to add new objects and fields are being created and then we try to move class or other components using those objects/fields. In this case, deployment fails.