We are all exposed to a number of substances that could potentially cause allergy, yet only some of us become allergic. There are alternative paths that the immune system can take when encountering a new molecule.
When an allergen first enters the body, an antigen-presenting cell digests it, presents it on its surface and introduces it to a T cell. What happens next determines whether the person will develop an allergy or not.
In a normal reaction the T cell differentiates into a Th1 cell, which in turn interacts with a B cell, releasing cytokines that promote the B cell to differentiate into a plasma cell, which will start producing IgG antibodies. The IgG antibodies have a protective function. They help to immobilize and destroy the allergens without causing an allergic response.
However, if the T cell differentiates into a Th2 cell, a different path is activated. The Th2 cell also interacts with the B cell and promotes it to differentiate into a plasma cell, but instead of IgG the plasma cell will produce IgE antibodies. The IgE’s bind to the surface of mast cells, priming them to recognize the allergen the next time it enters the body. This process is called sensitization.
It is not clear why some people become sensitized to certain allergens and some don't, but after sensitization each new encounter with the allergen induces an allergic reaction.
Read more about the immunological mechanism of the allergic reaction.