Chloramines. Specifically trichloramine. The subject of chloramines comes up frequently because people often blame “chlorine” for the chemical smell at the pool; and many people love to point out that "chlorine" is technically not the correct term for describing the problem. To be technically correct, the “chlorine” smell used to describe “bad air” is actually from chloramines, specifically trichloramine.
For example, USA Swimming published an article about "The Air Quality Issue," noting that "Indoor pools are increasingly experiencing problems with “'bad air.'" They correctly posit that the “bad air” problem is caused by "chloramines in the water: not chlorine, but chloramines." They also point out that chloramines are released from the water when the water is agitated.
Here is a link to several scientific articles explaining that pool problems are caused by chloramines: PubMed Articles.
Chlorine is what gets added to the pool to sanitize the water. Chloramine is something that gets made when the chlorine reacts with nitrogenous molecules. (A nitrogenous compound is a molecule that has some nitrogen atoms in it; these molecules can also be described as "amines.")
Technically the word "chlorine" means the element, Cl2. See wiki. In its pure form, the element chlorine exists as a yellowish gas. Chlorine is caustic and poisonous. To be clear, swimmers are almost never exposed to "chlorine." Rather, the "chlorine" in pools is hypochlorous acid. See wiki.
Chlorine forms hypochlorous acid when it reacts with water (which is present in all pools). Adding chlorine/hypochlorous acid to a pool can be accomplished in a variety of ways. Pool facilities often add some form of hypochlorite salt, such as calcium hypochlorite. See wiki. Adding hypochlorite salts to pool water provides hypochlorous acid, which is often referred to as "chlorine." All of this accomplishes the same thing: adding bleach, aka "chlorine," (really hypochlorous acid or hypochlorite) to the swimming pool. See Swimming in Bleach.
Chloramines, bonded to your hair. Just like the "chlorine" smell in the pool air is caused by chloramines not chlorine, the chemical smell that lingers on hair is caused by chloramines.
All hair is made from protein. Hair is primarily composed keratin. See wiki. All proteins, including keratin are made from amino acids. See wiki. (describing protein as "large biological molecules, or macromolecules, consisting of one or more long chains of amino acid residues.") All amino acids are made from nitrogen. See wiki. ("important organic compounds composed of amine (-NH2) and carboxylic acid (-COOH) functional groups, along with a side-chain specific to each amino acid. The key elements of an amino acid are carbon, hydrogen, oxygen, and nitrogen, though other elements are found in the side-chains of certain amino acids"). As such, hair is a nitrogenous compound, that is, a molecule that has some nitrogen atoms in it.
Nitrogenous compounds (including amino acids making up proteins in human hair) react with "chlorine" in the pool to form chloramines. See wiki at "Reactivity of HClO with biomolecules" and "Reaction with protein amino groups" ("Hypochlorous acid reacts readily with amino acids that have amino group side-chains, with the chlorine from HClO displacing a hydrogen, resulting in an organic chloramine").
Chloramines, bonded to your skin. Just like the "chlorine" smell in the pool air is caused by chloramines not chlorine, the chemical smell that lingers on skin is caused by chloramines.
All skin is made from protein. Skin is primarily composed keratin. See wiki (explaining that the outer layer of skin is called the epidermis, which is made of "95% keratinocytes," which are proteins). All proteins, including keratin are made from amino acids. See wiki. All amino acids are made from nitrogen. See wiki. As such, skin is a nitrogenous compound, that is, a molecule that has some nitrogen atoms in it.
Nitrogenous compounds (including amino acids in the proteins making up human skin) react with "chlorine" in the pool to form chloramines. Those chloramines form a layer on your skin. See Pool Chlorine and Skin (providing illustration of chlorine reacting to form a layer of surface bonded chlorine on the skin).
Predominantly peeing in the pool. Also, sweat, but mostly pee.
As discussed above chloramine (specifically trichloramine) causes the problems associated with "bad" air and water in swimming pools. Adding chlorine (e.g., hypochlorous acid or hypochlorite salts) to pool water does not create these problems because these are not chloramines. However, adding nitrogenous materials to the chlorinated pool water does create "bad" air and water conditions. When nitrogenous materials are added to the chlorinated pool water, those nitrogenous materials react with the chlorine to form chloramines.
For most swimming pools, the primary source of nitrogenous materials is urine from people peeing in the pool.
Urine has a molecule called urea in it. See wiki. (Explaining that urea is a nitrogenous compound "with the chemical formula CO(NH2)2. The molecule has two —NH2 groups joined by a carbonyl (C=O) functional group.") Accordingly, urea reacts with the chlorine in swimming pools. Over time, that urea reacts with chlorine to form chloramine. As discussed above, chloramine is the chemical that makes pool air and water "bad."
Most authorities agree that the best way to manage chloramines in swimming pools is to prevent the problem in the first place. See, for example, Recreation 2006 Focus on Trichloramine in Indoor Pools. Nevertheless, some chloramine formation will be inevitable because swimmers sweat in the pool. Also, so long as chlorine is used to sanitize pools, a layer of lingering chlorine will form on swimmers' hair and skin.
This seems painfully obvious. Urea (from urine) is the primary source of the irritating chloramine molecules. The pool needs urea to make chloramine. Not adding this ingredient would prevent making the unwanted chloramines. Keeping pools free from urea would dramatically improve the quality and health of pool water. This sounds simple. But, culturally, we accept and even glorify peeing in the pool. For example, US Weekly ran an article about how Olympic Gold Medalist Ryan Lochte regularly pees in the pool. According to Lochte, "I think there’s just something about getting into chlorine water that you just automatically go. I didn't during the races, but I sure did in warm-up."
Adding fresh water to the pool dilutes the concentration of nitrogenous compounds and chloramine. Accordingly, adding fresh water to the pool reduces the concentration of the irritant (chloramine) and also the source of the irritant (nitrogenous compounds which are converted into chloramine).
Exchanging the air is a simple treatment for high concentrations of chloramine in the air. Either (a) removing chloramine rich air or (b) adding fresh air to the chloramine rich air results in diluting the chloramine concentration in the air. This solution should be fairly easy to understand: for example, note that outdoor pools, with infinite air exchange, have no issues with "bad air."
Swimmers can easily wash chloramines off hair and skin with vitamin C. See How to Eliminate Chloramines from Hair and Skin.
Dr. Andrew Chadeayne is a lifelong swimming and PhD chemist. He was the first to understand the "lingering chlorine" phenomenon and develop a formula for eliminating chloramines from hair and skin. Here is a video explaining his story.