A Papal conclave is a meeting of cardinals. The cardinals meet to elect the next bishop of Rome, to become pope. This becomes necessary when the old pope dies or resigns. Usually, popes do not resign, though.
Originally, the conclave was started in Italian city states, in the 12th century. These cities needed to elect officeholders, and the election needed to be free of party politics. Events such as the Investiture Controversy in medieval Europe led to people wanting "free" elections, with a medieval understanding of free. Methods were often combined, the elements used were Acclamation, naming of candidates by predecessors, or by univolved people, and using "electrors" who would agree on the successor, behind closed doors. Earliest examples are that of Genua, in 1157, Pisa, in 1162-64, or Pistoia.