Context. Density and velocity fluctuations on virtually all scales observed with modern telescopes show that molecular clouds (MCs) are turbulent. The forcing and structural characteristics of this turbulence are, however, still poorly understood. Aims: To shed light on this subject, we study two limiting cases of turbulence forcing in numerical experiments: solenoidal (divergence-free) forcing and compressive (curl-free) forcing, and compare our results to observations. Methods: We solve the equations of hydrodynamics on grids with up to 1024(3) cells for purely solenoidal and purely compressive forcing. Eleven lower-resolution models with different forcing mixtures are also analysed. Results: Using Fourier spectra and A-variance, we find velocity dispersion-size relations consistent with observations and independent numerical simulations, irrespective of the type of forcing. However, compressive forcing yields stronger compression at the same rms Mach number than solenoidal forcing, resulting in a three times larger standard deviation of volumetric and column density probability distributions (PDFs). We compare our results to different characterisations of several observed regions, and find evidence of different forcing functions. Column density PDFs in the Perseus MC suggest the presence of a mainly compressive forcing agent within a shell, driven by a massive star. Although the PDFs are close to log-normal, they have non-Gaussian skewness and kurtosis caused by intermittency. Centroid velocity increments measured in the Polaris Flare on intermediate scales agree with solenoidal forcing on that scale. However, A-variance analysis of the column density in the Polaris Flare suggests that turbulence is driven on large scales, with a significant compressive component on the forcing scale. This indicates that, although likely driven with mostly compressive modes on large scales, turbulence can behave like solenoidal turbulence on smaller scales. Principal component analysis of G216-2.5 and most of the Rosette MC agree with solenoidal forcing, but the interior of an ionised shell within the Rosette MC displays clear signatures of compressive forcing. Conclusions: The strong dependence of the density PDF on the type of forcing must be taken into account in any theory using the PDF to predict properties of star formation. We supply a quantitative description of this dependence. We find that different observed regions show evidence of different mixtures of compressive and solenoidal forcing, with more compressive forcing occurring primarily in swept-up shells. Finally, we emphasise the role of the sonic scale for protostellar core formation, because core formation close to the sonic scale would naturally explain the observed subsonic velocity dispersions of protostellar cores.