A tattoo is produced by puncturing the skin with special needles dipped in indelible inks. A needle injects ink into the cells of the dermis - the second layer of the skin.
Our skin consists of three layers: the epidermis, dermis and subcutaneous tissues. The outer layer that acts as a protective barrier and contains no blood vessels is called the Epidermis. Below that is a thicker layer called dermis and that is where tattoos go.
Because epidermis is constantly being replenished (we continue to produce and shed the top layer of the skin throughout lifetime), the tattooist pushes ink through the epidermis and leaves it in the dermis. The dermis stays pretty much the same for our entire life and this is why tattoos stay permanent while many other things done to the skin don't.
A tattoo needle goes approximately 1.5mm (1/16 of a inch) into the skin. A tattooist must make sure that the ink goes in just deep enough to be permanent, but not to deep. The depth varies across the body - it's deeper on the soles of the feet and thinner in other places like genitals.
If tattoo is done too deeply, into the third layer of the skin called subcutaneous layer, it can cause unnecessary pain and bleeding. It can also look blurred even as soon as it's healed, because you have to look deeper (through more layers of the skin) to see it. If any less than a millimeter, it might leave scratches and simply wear off.