Answer:
There are multiple ways but some more usual ones are Appointment in which the states governor or legislature will choose the judges. The second is called merit selection in which the judges are chosen by a legislative committee based off of the judges past records. Here is a link that gives more of the ways and in more detail as well:
https://litigation.findlaw.com/legal-system/how-are-judges-selected.html