Canon 377 states it clearly: "The Supreme Pontiff freely appoints bishops or confirms those lawfully elected."
The Code of Canon Law (Canon 377, 2) legislates that at least every three years the bishops of an ecclesiastical province or a bishops' conference are to draw up a list of priests suitable for the episcopate and send the list to Rome. And each bishop individually has the right to make known worthy candidates.
Also, according to the Code, in the case of appointing diocesan bishops the papal legate, after consultation with different people, suggests candidates (Canon 377, 3). Canon 377 further specifies that, in the case of an auxiliary bishop, the diocesan bishop proposes a list of at least three candidates.
To sort through these lists and assist the pope in his decisionmaking, there is the Vatican Congregation for Bishops. But in the end, it is the pope who decides the appointment of bishops and the terms of their appointments.