- Have a public vote, direct legitimation (or via some extra electoral college or something) this means that judges have to be "popular" and run campaigns and question is, if that's really smart ...
- Have the "juristical class" elect within, so judges from lower courts would lick somebody, or current judges elect additional ones. That would put judges into their own "class" and remove all democratic legitimation
- or do what is done and have a democratically elected body do it. In the case of the U.S. it's done by a combination of president (nominating) and Senate (confirming) where the Senate represents the different states.
It is one of the tough problems.
For the pardon the idea comes from absolutist times where a King would pardon as he likes. The modern interpretation comes from correcting "blind" justice. Justice has to rule according to law. But sometimes one either might decide that a law was bad and than a pardon might be a way to correct that (ideally if law is rewritten as well) and sometimes there are hard cases, like the 90 year old who should get a chance to die outside of prison, for sake of family etc.
Generally the system assumes the actors act mostly in good faith and were removed (impeachment etc.) otherwise.