There can be intentional stains (such as wood stains or paint), indicative stains (like food coloring or adding a substance to make bacteria visible under a microscope), natural stains (such as rust on iron or a patina on bronze), and accidental stains (like spilling ketchup on your shirt.) While the types of stains are very different in application, they all form in the same basic ways:
The primary method of stain formation is surface stains, where the staining substance is spilled out onto the surface or material and is trapped in the fibers, pores, indentations or other capillary structure of that surface. The material that is trapped coats the underlying material, and the stain reflects back light according to it's own color. Applying paint, spilled food, and wood stains are of this nature.
A secondary method of stain involves a chemical or molecular reaction between the material and the staining material. Many types of natural stains fall into this category. Finally, there can also be molecular attraction between the material and the staining material, involving being held in a covalent bond and showing the color of the bound substance.
Different types of material can be stained by different substances, and stain resistance is an important characteristic in modern textile engineering. Various laundry techniques exist to attempt to remove or minimize existing stains, and stain removers are an important type of chemical in laundry detergents. Some stand-alone stain removers also exist.
In many cases, stains can be affected by heat , and may become reactive enough to bond with the underlying material. Extreme heat, such as from ironing or dry cleaning, can cause a chemical reaction on an otherwise removable stain, turning it into a chemical compound that is impossible to remove.
A detergent (as a noun) is a material intended to assist cleaning. The term is sometimes used to differentiate between soap and other surfactants used for cleaning. As an adjective pertaining to a substance, it (or "detersive") means "cleaning" or "having cleaning properties"; "detergency" indicates presence or degree of cleaning property.
Laundry detergent, or washing powder, is a substance which is a type of detergent that is added when one is washing laundry to help get the laundry cleaner. Laundry detergent has traditionally been a powdered or granular solid, but the use of liquid laundry detergents has gradually increased over the years, and the popularity of liquid detergent now rivals that of solid detergent. Some brands also manufacture laundry soap in tablets and dissolvable packets, so as to eliminate the need to measure soap for each load of laundry. In some countries where washing clothes by hand is more popular, detergent bars are more popular. Recently, environmentally friendly detergents have enjoyed a surge in popularity.
Source: Wikipedia (All text is available under the terms of the GNU Free Documentation License)