In the United States, we have both federal courts and state courts.
Federal courts hear civil cases that apply to the entire US government, or federal system, as opposed to criminal cases, and can be broken into two different categories. One major category consists of the Article III courts. Federal trial courts, appellate courts, and the Supreme Court all count as Article III courts ("How are Judges Selected?").
Federal district courts are trial courts that "hear cases involving the constitutionality of a law, cases involving the laws and treaties of the U.S. ambassadors and public ministers, and disputes between two or more states" ("Court Role and Structure"). The 13 appellate courts "hear challenges to district court decisions" and decide whether or not a federal law was "applied correctly" in the district court ("Court Role and Structure"). The Supreme Court oversees decisions made by all federal and state courts concerning federal law.
For all Article III courts, judges are nominated by the U.S. President, and Congress confirms the nominations. Judges of all Article III courts remain in office for life ("How are Judges Selected?").
The second major category of federal courts are Article I courts, which are specifically created by Congress for the purpose of examining federal bankruptcy cases, tax cases, and certain military cases. For these courts, all judges are appointed by Congress, and the judges only remain in office for 10 years ("How are Judges Selected?").
In contrast to federal courts, there are several different means by which judges of state courts can be appointed. Judges can be appointed by either the "state's governor or legislature," selected by a "legislative committee," voted into office by a "partisan election" based on political party, or even voted into office by a "non-partisan election" in which party affiliation is not stated ("How are Judges Selected?").