The most effective self tanning products are the ones that list dihydroxyacetone (DHA), an isomer of glyceraldehydes, as an active ingredient.
According to the American Academy of Dermatology, they begin to work within around 40 minutes to an hour.
DHA is a dull (in coloring) sugar, which is important in the metabolism of carbohydrates.
It interacts with the dead cells located in the stratum corneum or outermost layer of the epidermis. In other words: DHA reacts with amino acids in the epidermis, producing a natural pigment called melanoidin that bonds with proteins in skin cells.
And results are a change of color that can last up to about seven days.
There are a couple of things to note here:
First: although melanoidin is produced, and melanoidin and melanin (the dark pigment that enables a sun tan to develop via UV exposure) work together in the absorption of harmful rays, a self-tan only provides about a SPF 2, more or less, not high enough to offer enough protection.
So take care to wear protective outer garments, eyewear, etc. and / or a sunscreen.
And second: note for a quick overview that in general, sunless...