It is my understanding that US judges are supposed to be impartial. Indeed, a common symbol of the justice system is Lady Justice wearing a blindfold as a symbol of this ideal.
There are a number of judges that are elected, which seems to me like a potential conflict of interest that would lead the judge to not be impartial. After all, they need to appeal to constituents for reelection, so they may not choose the most just outcome for a case if they think that an unjust one would appeal to constituents.
So if judges are supposed to be impartial, why are some elected if that risks them having biases towards their constituents?