Photons, due to the virtually vanishing photon-photon interaction, constitute to very good approximation an ideal Bose gas, but owing to the vanishing chemical potential a (free) photon gas does not show Bose-Einstein condensation. However, this is not necessarily true for a lower-dimensional photon gas. By means of a fluorescence induced thermalization process in an optical microcavity one can achieve a thermal photon gas with freely adjustable chemical potential. Experimentally, we have observed thermalization and subsequently Bose-Einstein condensation of the photon gas at room temperature. In this paper, we give a detailed description of the experiment, which is based on a dye-filled optical microcavity, acting as a white-wall box for photons. Thermalization is achieved in a photon number-conserving way by photon scattering off the dye molecules, and the cavity mirrors both provide an effective photon mass and a confining potential - key prerequisites for the Bose-Einstein condensation of photons. The experimental results are in good agreement with both a statistical and a simple rate equation model, describing the properties of the thermalized photon gas.