You can also measure the redshift of the line, so that you know how the gas is moving. In dense regions gas atoms hit each other so much that they join together to form molecules. These have spectral lines in the millimeter and submillimeter region of the spectrum. M20 formaldehyde plot Many organic molecules have been found in these clouds. They are dark and cold so are the places where new stars form.
Stars form out of interstellar clouds.
One way we know this is that O stars, which have the shortest main-sequence lifetimes, are often found in the vicinity of interstellar clouds. The main condition is that gravity overcomes pressure . This can happen in several ways. One way is for a supernova to squeeze the cloud in on itself. For gravity to be strong we want a lot of matter in a small space, i.e. a high density.