Molecules such as these require a few things to form. First of all, it needs to be a slightly cooler environment than what you would find in stars. In fact, TiO absorption is a main feature of the visual spectra in cooler stars, or those with spectral class M. (So if you ever find yourself having to classify stellar spectra in your astronomy classes, that's a dead giveaway!)
Molecules in the gas phase can also build larger and larger molecules and, eventually, dust grains that play an important role in star and planet formation. TiO2 can then act as a catalyst for making larger and larger molecules in the environment around stars. We know from decades of radio observations that interstellar space is full of molecules, even simple amino acids that may have later formed the basis for life.
PHOTOS: ALMA: New Jewel of the Atacama Desert
In addition, molecules are excellent tracers of the physical conditions of the gas clouds in which they reside. Molecules are detected through their spectral lines, that is, the emission in certain wavelengths or "colors" that they give off as they change their energy state. In this particular discovery, the molecules were changing their rotational state, or how they spin. From what we know of these molecules and their physical behaviors, the astronomers were actually able to determine how much TiO and TiO2 is in the environment.