This is a very general answer to your question.
According to the Chemistry World podcast transcript, Cyanoacrylate and the article The Chemistry of Superglue (Brubaker, 2000), the main ingredient cyanoacrylate, which is
a type of plastic known as an acrylic resin. It exists in the tube as single molecules in liquid form. But when they come into contact with water, the molecules react with hydroxide ions to form long polymer chains that set into a hard solid. As there is a thin layer of moisture covering most surfaces, cyanoacrylate can bond them together very effectively.
This also explains why superglue tends to harden very quickly when in contact with skin.
A diagram of cyanoacrylate polymerisation in the presence of water is shown below:
from the University of Rochester, who also state that asides from water, that the presence of
Weak bases (such as those on the proteins in skin) work even better
for polymerising the cyanoacrylate.