Precedent from other similar cases is often cited in US court cases because the US follows stare decisis in keeping rulings consistent. However, is this based on how the courts tend to run unofficially, or is there an official document describing how precedent should be set, cited, followed, etc.? Basically, is there some official document that says that courts should consider "precedent" or does it just work that way because it has always done so?
There isn't to the best of my knowledge, any single document that tells courts to follow precedant or when and how to do so. Each State, and the Federal government, has a set of court rules of procedure. These will indicate, among many other things, the form that should be used in citing previous cases, but that is about form, not content -- about how to cite a case, not about when a court should or should not cite one.
Some precedents are what are called persuasive. These are from other court systems: say a different state, or even another country. These also include rulings from other courts at the same level, say from a different district, or even from lower courts.
Other precedents are binding. These are from a superior court to the one where the case is cited. In a state's lower court, rulings of that state's supream court are binding. In Federal district courts, rulings of the Court of Appeals for the same Circuit, and of the US Supreme Court are binding. In Federal appeals courts, rulings of the US Supreme Court are binding. They are also binding in state courts on matters where the US constitution is involved, or where Federal law supersedes state law.
Prior rulings of the same court are strongly persuasive, but not strictly binding -- a court can overrule its own precedents when it thinks the law or justice requires this, although most courts are reluctant to do so. Or more often it can distinguish a previous ruling, saying, in effect: "that previous ruling is still valid, but this is a different case in such and such a specific way, so the result is different".
Students in law school spend a good deal of time learning how precedents are cited, and how they should be used, learning what sorts of things are controlled by precedents, and how to find the precedents that apply to a particular case. When they become lawyers and then judges, they taken this body of learning with them, and use it in writing decisions, and opinions that explain those decisions.
New law from the legislature can reverse previous court decisions, except in the case of decisions interpreting the constitution (federal or state). Amendments can change the constitution. Judges must adapt to such changes in the law.
To a significant extent our system of precedent is a matter of tradition, going back largely to the common-law courts of England, although it has been modified by specific legislation in many ways, as well as by more recent court decision and practice. It is passed on in law schools, in legal apprenticeships of various kinds, and in individual court decisions.
There would probably have to be two answers to this question: one for the Supreme Court, and another for lower courts in the federal system.
For the Supreme Court, the answer is no.
Article III of the U.S. Constitution establishes the Supreme Court but offers very little guidance on how it is meant to operate. Separation-of-powers principles prevent Congress or the president from telling the Court what procedures it must follow in making decisions, and even a decision by the Court itself on how to apply precedent would not be binding, as the Court could simply choose to adopt a new rule the next day.
Instead, the Court has simply operated as a spinoff of the English courts that preceded it, adopting the principles of binding precedent and stare decisis that have long defined courts in the common law system. If there is a court decision that originally announced those principles and laid out how to apply them, it probably goes back to the earliest days of common law, making it nearly 1,000 years old, and therefore somewhat difficult to locate.
For the lower courts, the answer is "sort of."
There is, as far as I know, no statute or regulation or formal rule of court that lays out the ideas of respect for precedent, binding and persuasive authority, etc. There are, however, many decisions of the Supreme Court -- binding on all lower courts -- explaining the importance of precedent and the obligation of lower courts to apply the rule announced in any Supreme Court case directly on point, and to use similar cases to reason their way to consistent conclusions when there is nothing directly on point.
Yes there are official documents
English common law, including stare decisis was adopted by each of the former colonies and the new nation of the United States in a Reception Statute very shortly after the Declaration of Independence.