Stain removal. Stain removal is the process of removing a mark or spot left by one substance on a specific surface like a fabric. A solvent or detergent is generally used to conduct stain removal and many of these are available over the counter.

Stain prevention 
If a stain has "set", it has become chemically bonded to the material that it has stained and cannot be removed without damaging the material itself.  It is therefore important to avoid setting stains that one wants to remove.  This can be done by avoiding heat (by not pressing or ironing the stain), sponging stained materials as quickly as possible, using the correct solvent (some solvents will act as catalysts on certain substances and cause the stain to set more quickly), and avoiding rubbing the stain.

Stain removal is possible due to hydrophilic end and hydrophobic end present in detergents. The hydrophilic end of the detergent attaches itself to the water molecules while the hydrophobic end attaches itself to the material and the molecules of the stain. The hydrophilic end allows for the stain molecules to be water soluble.

Stain removal
Most stains are removed by dissolving them with a solvent.  The solvent to use is dependent on two factors: the agent that is causing the stain, and the material that has been stained.  Different solvents will dissolve different stains, and the application of some solvents is limited by the fact that they not only dissolve the stain, but also dissolve the material that is stained as well.

Another factor in stain removal is the fact that stains can sometimes comprise two separate staining agents, which require separate forms of removal.  A machine oil stain could also contain traces of metal, for example. Also of concern is the color of the material that is stained.  Some stain removal agents will not only dissolve the stain, but will dissolve the dye that is used to color the material.

Solvents
These are some of the solvents that can be used for stains, with some examples of the stains that they are capable of removing:

Oxidizing solvents
Household bleach generally removes a stain's colour, without dissolving the stain itself.  Hydrogen peroxide is also a bleaching agent that can be used to treat stains. Sodium perchlorate is a bleach alternative.

Reducing solvents
Sodium hydrosulphite and sodium hypochlorite normally used for removing stain and dyes colours.

Lacquer solvents
Acetone is good for removing some glues, nail polish, ink stains, rubber cement, and grease.  Nail polish remover may contain acetone, however for general use it is best to obtain bottled acetone from a hardware store.  It can be diluted with water.

Inert solvents
Inert solvents are those that do not react with anything in the stain. Water for example can be considered as an inert solvent for some kinds of stains. In this case dissolving the stain is not a chemical reaction but a physical process.

Detergents
Surfactants (detergents) are molecules that have one polar end and one non-polar end and can be used for stain removal. They can help to emulsify compounds that are not usually soluble in water. For example, if you put oil in water, they tend to stay separated. If you put oil, detergent, and water together and shake them up, then you get a mixture that can help to remove stains.

Acids
Lemon juice, containing citric acid which is the active bleaching agent, can effectively remove stains.  Its action can be accelerated by exposing the stain to sunlight, or some other UV source, while soaking.
Various acids were used in the past such as Phosphoric acid as used in Calcium Lime Rust Remover (CLR) and Hydrofluoric acid as used in the Australian product made in Queensland called "Rustiban". Both of these Acids have been removed from sale to the general public due to toxicity concerns. Both of these acids were used primarily to remove rust.
Other rust removal acids are oxalic acid. 

Oxalic acid, also called ethanedioic acid, belongs to the carboxylic acid family. Oxalic acid is used widely as an acid rinse in the laundry industry due to its ability to remove rust and ink stains. Oxalic acid converts insoluble iron compounds into a soluble complex ion. It is because of this property that oxalic acid is one of the primary components in commercial solutions used to remove scale from automobile radiators. 
See also Borax or Boric Acid,  Vinegar ( or acetic acid ) which can also help bring out stains.

Alkalis
Alkaline stain removers are mostly used in the removal of oil-based stains via the process of saponification. Sodium hydroxide is also commonly used in drain cleaners. It allows grease and other oils to dissolve into aqueous solutions like water. Other alkalis such as potassium hydroxide (much stronger than sodium hydroxide) are also used. Both of these are hazardous chemicals and react with animal flesh. High enough concentrations, as in industrial cleaners, and/or significant exposure time without adequate protection of the exposed area will cause serious chemical burns. Alkalis helps remove dirt, grass, and clay stains. Ammonium hydroxide and borax are also used.

Enzymes
Enzymes are used in "bio" laundry detergents to digest protein-based stains like chlorophyll-linked proteins in grass stains and hemoglobin-linked proteins in blood stains. One of the most intensively studied protease for this purpose is subtilisin.

Others
 Baby powder This can be used to absorb grease before washing, especially for fresh stains.

 Club soda This can be used for pet stains and out of doors. There is no chief underlying chemical reason why club soda would be superior to plain water in stain removal.

 Glycerine This can be used to soften "set" stains, especially on wool and non-water-washable fabrics.

 Boiling water This can be used to take out fruit juice stains. Hot water activates the detergent and as well as sanitize the cloth. It works best on protein-based stains. 

 Lukewarm water Water is an excellent solvent for colorless sugary stains, such as sticky residues of dropped candy as well as apple jam and honey.

Application of solvents
There are four ways to apply a solvent to a fabric for removing stains:
Soaking
This is a common method used in households to remove a variety of stains. Depending on the stains composition, the stained material is left to soak in a container of warm or cool water and solvent. Such solvents can include laundry detergent, bleach, peroxide, vinegar, or a cleaning product with enzymes. Soaking in the water-solvent mixture allows for the stain to be loosened from the fabric, thus making it easier to remove with scrubbing or washing. 
Application of PressureSometimes called tamping, this method involves pressing the solvent into the stain. The pressure allows for the solvent to better penetrate both the material as well as the stain. This technique is commonly used on durable woven fabrics, as less durable material may be damaged. In this method a soft bristled brush is used to directly press the solvent onto the stain. When using this method it is important to not use too much pressure, so as to avoid damaging the stained material. 
Front SpongingThis is the most common way of treating non-washable fabrics.  The front of the fabric is sponged with a sponge that is soaked in the solvent being used.  The rear of the fabric should be backed up with a clean, absorbent, material.  The stain is rubbed with the sponge radially, from the centre of the stain towards its edge.  It is important not to rub the sponge in a circular motion, as that causes the stain to spread in rings.
Back SpongingThe stained side of the material is placed face down on a clean, absorbent, material.  The back of the fabric is then sponged with a sponge that is soaked in the solvent being used.  It is important not to rub the material with the sponge, but to use a padding motion, so as not to spread the stain.  The solvent dissolves the stain, which is deposited on the absorbent material beneath.  To completely remove the stain it may be necessary to use more than one absorbent pad.

Hair dye stains

Hair coloring products are commonly used in both households and salons. Due to the length of time that hair dye must be on the hair to achieve deep, even results, it often seeps or drips down onto the hairline, ears or neck, causing unsightly and irritating stains on the skin. Dye users are not universally affected, most likely due to the variations in lipid or natural oil composition on the skin surface from one person to the next.

Many salons and stylists advocate the use of petroleum jelly to prevent stains. Placing a rim of petroleum jelly around the hairline creates a physical barrier to prevent the dye from running down onto the skin of the forehead and neck, and fills the pits and recesses within the epidermal layer.

Chemistry
Human hair is composed largely of keratin protein, which has a negative ionic charge, giving hair a negative ionic charge as well. As chemistry dictates, oppositely charged compounds attract and compounds with the same charge repel each other. Most hair dyes are positively charged, helping them attach to the negative sites in hair and contributing to a better bond between the dye and the hair.

Unfortunately, like hair, human skin is made of keratin and contains sites with a negative charge, and therefore, it also attracts the dye. Skin also has pores and other pits and recesses which allow dye to get physically trapped in the epidermal layer. These both contribute to the development of stains on the skin.

The dye itself can be directly absorbed through the skin and into the bloodstream. The stratum corneum (the outermost layer of skin also called the “horny layer”) contains a “lipid domain” that allows the dye to pool and provide opportunity to diffuse into the body. Some hair dyes can also irritate the skin with prolonged exposures. As a result, quickly removing or minimizing skin exposure to dye is often considered desirable.

Removal methods
While many home remedies exist to attempt to remove the stains from skin, there are many products distributed in traditional drugstore or discount channels for this purpose. The home remedies vary in effectiveness and carry the risk of skin irritation and abrasion as a result of excessive scrubbing, plus eye irritation if allowed to drip or run into the eye. Some of the more common home remedies include: bleach, ammonia, acetone, and rubbing alcohol.

The following are risks of the common removal methods:

Acetone
The CDC reports that repeated and prolonged exposure of the eyes to acetone has the potential to cause permanent vision problems resulting from corneal clouding.

Ammonia
Ammonia is also contained in many hair dyes. Hair colors containing ammonia have been safely used for years. However,  ammonia exposure can cause conjunctiva irritation of the eyes.

Bleach
Traditional bleach contains chlorine and/or hydroquinone. Chlorine can irritate and burn skin, as can skin-bleaching products .
 In the United States, the FDA has proposed a ruling to remove all skin bleaching products from being available over the counter. 

Isopropyl Alcohol
Concentrated isopropyl alcohol has been shown to irritate skin, and prolonged inhalation of the vapors can impair coordination and cause headaches. While it may be an effective stain remover, it must be used gently to avoid abrasion of skin.

See also 
Scientific American, "Removal of Stains and Spots", 20 November 1880, p. 329 (historical perspective)

References

Cosmetics
Household chemicals