There are typically said to be two types of precedents. These are binding precedents and persuasive precedents.
In some cases, courts are essentially required to follow precedents. These are called binding precedents. In the United States, a precedent is binding on a given court if it is issued by a higher court within that court’s appeal path. In other words, if the Ninth Circuit Court of Appeals, for example, makes a ruling, that precedent is binding on all district courts in the Ninth Circuit. They must obey that precedent as long as the issues in the case that they are deciding are substantially similar to the issues in the precedent.
In other cases, courts are not required to follow precedents. These are called persuasive precedents. These precedents are made, for example, by courts that are not above the given court in the appeals path. So, if the Ninth Circuit Court makes a ruling, a court in the Sixth Circuit need not adhere to that precedent. However, it can take that precedent as a piece of advice. It can consider that opinion and see if it wants to use the same logic in its own decision.