In the early days of the Church, many bishops, including the Bishop of Rome, were elected by the laity and clergy of the diocese. (Think of St. Ambrose, who was elected as bishop while he was still a catechumen!)
Over time, this narrowed to the clergy.