In the earliest days, the Christians in a city where there was a bishop elected a new bishop. The bishops from nearby towns would come and lay hands on him and conserate him a bishop. Later it was the clergy. In Rome the Chrisitian populus would elect the new bishop, (who as successor of Peter was also the Pope) later the clergy alone, and later the Cardinals.
The Pope may change the way his successor is appointed, or elected. Rules for the conclave (manner the Pope is elected) may be modified by any Pope to effect the conclave that elects his successor. The only thing a Pope cannot do is appoint his own successor.