Another name for dark spots on your skin is hyperpigmentation. There are a lot of reasons for them to form, and they are mostly harmless. Humans and many other animals have a substance in our skin called melanin, which offers a certain level of protection against damaging ultraviolet (UV) light. Exposure to UV radiation (i.e. being out in the sun for a while) is often a factor in the development of dark spots, but that's not always the case.
Other possible types are freckles, moles, acne, rashes, infections, or even just changes in skin color based on location on the body. These are typically benign, even if some people see them as a flaw in their complexion. Unfortunately, some dark spots can also be a sign of other health problems, namely cancer. Any skin growth that pops up without an explanation or previous occurrence deserves a trip to the doctor, if only to be on the safe side.