Every element (and/or molecule, depending on the wavelength range you're looking at), will have an absorption spectrum of its own. Each element has electrons orbiting the nucleus, and those orbits have certain energy levels. If a particular wavelength of light has an energy corresponding to the difference between two orbits, it gets absorbed. So each element has a set of wavelengths it absorbs.
Molecules have these too, but they are usually bands in the infrared range and so their behavior is a bit different, and making sense of them is a bit more complicated. We'll stick with elements for now.
Anyway, the absorption spectrum lets you determine which elements are there because you can look to see if any of the wavelengths absorbed are the same as those for a given element.
As for the amount of the element, you can do this by comparing the amount of light it absorbs compared to that of known amounts of the same element.