Histochemical reactions work based on the principle of chemical affinity. Specific stains have a high affinity for certain cellular components due to chemical interactions such as hydrogen bonding, ionic interactions, and hydrophobic interactions. When a tissue sample is treated with a stain, these interactions result in the selective coloring of specific structures, making them visible under a microscope.