The results of a systematic study of the optical properties of the YBa2Cu3O6+x-based insulators and superconductors are reported. Specifically, we present measurements and analysis of the optical reflectivity R of a series of YBa2Cu3O6+x crystals in the frequency range from 30 to 20 000 cm-1 (4 meV to 2.5 eV), and temperature range from 10 to 270 K. From R we obtain the real part of the frequency-dependent optical conductivity by Kramers-Kronig analysis. In our discussion, we emphasize the development of structure and spectral weight in as the compounds change from insulators to high-Tc superconductors with varying O content or Al doping. We identify the free carrier, and interband components of (), and focus on the free-carrier component. The free-carrier component is analyzed by calculating (,T) within a model in which carriers scatter from a spectrum of dispersionless oscillators parametrized by 2F() (where is the coupling constant and F() is the density of modes). For <50 meV, (,T) is well described by weak coupling (0.4) to an F() which is broad on the scale of kBT. From the fit we obtain the inelastic scattering rate as a function of T, and the spectral weight in the translational, or Drude mode, of the quasiparticles. Above 50 meV, cannot be fit by this scattering model, with any 2F(), which suggests a two-component picture of (,T). As T is lowered, a knee in R(), and a threshold in the corresponding (), is resolved, which we associate with the low-frequency edge of this second component. In addition, a second threshold in the range 15 20 meV is seen at low T, although the magnitude of the change in R is close to our detection limit of 1%. We compare the properties of these thresholds with expectations for a superconducting energy gap as described in BCS theory. Finally, we discuss the implications of other experiments, which also probe the spectrum of low-energy excitations in the cuprate superconductors, on the interpretation of (,T).