
Most judges on the state and local levels are elected, but judges on the federal level are appointed.
When there is a vacancy on the federal level, from Circuit Courts to the Supreme Court, due to retirement or death, the President considers people who are available and qualified to do the job.