Federal judges are appointed, state and municipal judges are appointed or elected depending upon the venue they serve.
Both methods have faults, such as favoritism at the appointment level, and then, electing judges is rarely a high priority among the general voting public most of whom have limited (if any) knowledge of the individuals running for a judgeship.
The importance of having judges who are appointed rather than elected is making sure the people serving on the bench are qualified and will adhere to written law rather than public opinion. Elections can often favor popularity over capability. Appointments take into consideration the judge's work and qualifications.
The idea is that they are not supposed to be politically affiliated. They are supposed to be nonpartisan interpreters of constitutional law meant to make decisions on the constitutionality of bills that are challenged. They cannot do this if they have to campaign for political support because that would require that they take a partisan stance of some sort to gain an advantage over their challenger. This problem is still not obviously avoided by appointment.
Federal judges are appointed instead of being elected to keep them honest. A judge who is appointed is not going to show favoritism over one person or another. This keeps politics out of the courtroom as far as the judge is concerned.
The Framers feared tyranny from the judiciary more than from the other two branches, so they placed deliberate limitations on the judiciary. As a result, the Federalist Papers reported that under their plan, "the Judiciary is beyond comparison the weakestof the three departments of power. . . . [and] the general liberty of the people can never be endangered from that quarter." 
As part of that plan, the Framers took care to ensure that judges were accountable to the people at all times. Although federal judges were appointed and did not face election, the Founders made certain that federal judges would be easily removable from office through impeachment, a procedure that today is widely misunderstood and rarely used. While the current belief is that a judge may be removed only for the commission of a criminal offense or the violation of a statutory law,  it was not this way at the beginning. As Alexander Hamilton explained, "the practice of impeachments was a bridle"  - a way to keep judges accountable to the people.
They either do something bad or they either retirer
they are freer to make decisions, with less outside pressure.
All federal judges are appointed by the President and confirmed by the Senate. They serve life terms and can be removed from office only by the impeachment process.
They are appointed to long terms so that politics will play less of a role in their decision-making.
They aren't ever, the executive branch elects the federal judges for a term of good behavior. In otherwords the president appoints them, never elections.
In the U.S., it varies by state. Federal judges are not elected; they are appointed.
it provided the framework for popular sovereignty
200 Bush appointees have been confirmed to the federal bench
Local judges are generally elected, but federal judges are appointed.
Not in the US. Federal judges are appointed. not elected.
(in the US) Federal judges are not elected, they are appointed by the President with the approval of the Senate.
Federal judges are appointed. The President nominates a candidate for a vacancy on the bench, and the Senate votes whether to approve or reject the nomination.
by being elected and appointed by the senate
No. All Federal judges are appointed, but most state judges are elected to office.
What are federal judges appointed for?
The constitution makes it so with checks and balances.
Because if they were elected the judges might not make fair decisions. They might favor the people who voted for them
If federal judges are elected, there can be less partisanship - if they are appointed, the politician appointing them will likely choose judges who agree with them politically.
Usually, elected judges are chosen by the general electorate at election times when their names appear on the ballot. In some states, "elected judges" are actually 'elected' by majority votes of the state legislature.