The standard definition of a pheromone is "a form of chemical communication between members of the same species." How pheromones work depends on what the end result of the communication is supposed to be, and what's doing the communicating.
The most research on pheromone communications has been in insects. Chemicals that elicit a specific response are one of the most important survival mechanisms in the insect world. Pheromones are used to mark a food source, leave a trail to food, signal danger and overcrowding, and to find a mate. Air currents are usually the delivery system for signaling danger and overcrowding and finding a mate. The chemical "plume" is emitted from the insect and carried by the wind. This plume is emitted by both sexes even when used for reproduction. For marking food sources and leaving a trail, pheromone delivery is in a form other than airborne. These processes are extremely complicated and have been used successfully as a way of controlling certain plant pests.
Synthetically produced sex pheromones and the anti-aggregation pheromones, i.e. overcrowding chemicals are used extensively in crop sciences and forestry.
Pheromones in the plant world are a primary defense mechanism. When something starts to chew on the plant it will emit chemicals as poisons against its attacker, often making itself unpalatable to whatever is trying to use it as food. Plants will also emit pheromones to other plants of the same species to trigger their defense mechanisms.
Pheromones in mammals have been organized into the following types: primer, releaser and information. The primer pheromones can cause changes in the endocrine system of the animal receiving the chemical signal from its own species, usually of the opposite sex. For example, male mice can emit a pheromone to speed up the maturity of female mice, causing them to be reproductively ready in a shorter period of time. The releaser pheromone triggers reproductive behavior, generally indicating the fertility and readiness in the female. The information pheromone tells about the animal's identity such as how dominant it is, how healthy it is, and even it's last meal. This is most likely what's going on when dogs sniff each other.
Pheromones in people are more controversial. Science has had a harder time verifying pheromone chemicals and their function in humans. There have been some studies strongly hinting at female menstrual synchronization but isolation of the actual chemical process remains elusive. There has also been great curiosity over the possibility of sex pheromone attractants for men and women but evidence continues to remain just out of reach. If chemical sexual attraction in people is ever identified, human dating and mating behavior will be forever changed.