Aren't they frequently appointed or they run unopposed?
True, they often run unopposed, but that doesn't free then from political pressure; if they make an unpopular decision, any lawyer could opt to run against them by simply campaigning as not the other judge. They would usually win and get a fantastic résumé boost.
In many localities there is no requirement that a judge have any prior legal training or experience.
So anyone, not just any lawyer.
When they are elected, even if they run unopposed they still tend to act tough on crime. If a judge or prosecutor started acting weak, the could very quickly find themselves opposed in the next election.