While planetary nebulae have been known for a long time, understanding of what they are had to wait for the advent of spectroscopy in astronomy. In the late 1800's when stellar spectroscopy was first being used people were surprised to find out that PNs had pure emission line spectra, rather than a continuum with absorption lines as was found for stars. The brigthest lines in PN spectra could not initially be identified leading to the hypothesis that an unknown element, named "nebulium" was producing these lines. However more observations showed that various of these unidentified lines varied in strength from object to object in a way that indicated that they came from different elements, and this "nebulium" idea was fairly quickly abandoned.
This is what the solar spectrum looks like viewed with a prism, showing the bright continuum and the dark absorption lines from the star. (This image is created from a digital spectrum of a G2V star similar to the Sun, rather than being from an actual prism spectrum. I have seen the solar spectrum by eye using a grating spectrograph and I can vouch that it looked very much like this image. With a prism, which does not have as good a wavelength resolution, many of the fainter lines would be difficult to see at casual inspection.)
This spectrum image is made from the observed spectrum of the PN NGC 7027, which is a bright and fairly compact PN in Cygnus. The really bright green line at 5007 Angstroms and the fainter companion line at 4959 Angstroms cause these PNs look green to the eye. When displayed like this you only easily see the one bright green line, and I had to mark the other two barely visible lines in the spectrum with the arrows. You can just barely see a red line, the 6563 Angstrom H alpha line, in the spectrum if you look hard, or if you enlarge the image. (As with the G2V spectrum above, all these spectra are simulated prism spectra based upon modern digital spectra of objects, or are the result of simulations of the nebular emission.)
The line at 5007 Angstroms is often the strongest line in the spectra of PNs, and so it is used in imaging surveys to discover these objects, especially in external galaxies. By taking an image on the spectral line and another image just off the line and subtracting the images, the PNs pop up as bright objects while normal stars subtract out of the difference image. The line is due to doubly ionized oxygen, so the central star has to be rather hot to ionize the oxygen atoms to O+2. Very "young" PNs that are still getting hotter may not be able to excite this line, and very "old" PNs where the star has cooled off may also not have this line, but a large fraction of them do have this line as the strongest line in the optical spectrum.
When the image is displayed with a logarithmic intensity scaling, as above, it becomes clear that there are lots of other lines present, but they are generally much weaker than the strong lines. The human eye sees brightness on a logarithmic scale, so if the spectrum could be made bright enough a person would see the weak lines and the strong lines as shown above.
Some of the lines here could be identified as due to Hydrogen and Helium, while many of the other lines were not initially identified. If you compare this spectrum with the two simulated spectra below you can see that one yellow line is due to He and that there are four lines of the Hydrogen Balmer series present in the NGC 7027 spectrum. If one looks one finds in fact a number of He lines in the spectrum besides the strong yellow line.
This is from a computer calculation of the spectrum of a pure Hydrogen nebula, since I don't have a spectrum of such a thing.
This is from a computer calculation of the spectrum of a nebula with only Hydrogen and Helium, since I don't have a spectrum of such a thing.
You may see it better with the spectra side by side (H above, the NGC 7027 spectrum in the middle, H plus He below):
About 100 years ago the mysterious lines in PN spectra were identified as being collisionally excited "forbidden" lines of the ionized and neutral forms common elements such as oxygen, nitrogen, and carbon. These lines are not actually forbidden, but they only happen in nature under very low density conditions. A PN is a very low density cloud of ionized gas around a central star; the star is producing ultraviolet radiation to ionize and excite the gas around it.
The lines seen in the spectra of PNs are of two types: recombination lines formed when an ion and an electron combine, leading to a cascade of the electron down the ground state, and collisionally excited lines from low lying energy levels in atoms or ions. The recombination lines include the H and He lines and many very faint lines of other elements observed in the spectra. However most of the stronger lines observed in PNs are for collisionally excited lines, whch we think are excited by electron collisions in the ionized plasma created by the star. Many of these low lying energy levels at a few electron volts above the ground state cannot radiate very effectively. On Earth the transitions don't take place under normal conditions because another collision takes place before the electron in these levels can radiate light. Even if one has a high vacuum and the gas density in the chamber is low, the gas inside still collides with the walls of the vacuum chamber fairly frequently. In the very low density conditions of these PNs -- densities are estimated to be typically of order 1000 atoms per cubic centimeter, which is equivalent to a pressure of the order of 10-16 atmospheres. Having no walls to collide with, the ions and atoms in the gas can sit there until the forbidden transition takes place. The emission is very weak, but with a cubic light year or so of the gas even very weak emission can add up to something that is bright enough to observe.
In principle a careful analysis of the spectrum of a PN can provide us information about the temperature and density of the gas, as well as the abundances of the elements. These days this is usually done using a photoionization code to simulate the atomic physics and see what the line strengths are expected to be for different situations, and then adjusting the parameters to match the observed line ratios. Gary Ferland's CLOUDY code is an example of one of these simulation codes (intended for experts only...).
One of the remaining big puzzles about PNs is that analysis of the recombination lines does not produce results consistent with the analysis of the collisionally excited forbidden lines. The physics of both of these processes are well understood, and actually closely related, so it is hard to understand why the two types of lines seem to indicate very different physical conditions in the nebula.
People have been trying to understand the reason for this for more than 50 years, and no entirely satisfactory solution has been found. There are two general ideas for explaining this, each with its own "camp": one is that there are significant variations in the plasma temperature over the nebula, and the other is that there are small pockets of gas which totally lack hydrogen distributed through the nebula. In either case its difficult to figure out how this state of affairs can be created, so I am not convinced of which of these is likely to be correct.