As Kyle Hill writes on Nerdist, the fluid mechanics that make a tattoo gun work are pretty spectacular: Artists aren't simply injecting ink from some chamber in the machine into your skin. They dip the needles into pots of ink, the same way another artist would dip a brush. (In fact, you can watch Smarter Every Day host Destin get an ink-free needle jab in the video)
The ink is actually held between the needles. After those needles puncture your skin (just the upper layer, if your tattoo artist knows their stuff -- going beneath the fat will cause your tattoo to blur), the ink held between the needles is drawn down. From Nerdist:
Once there are hundreds of tiny holes leading down to your dermis — the layer of skin between the epidermis (outer layer) and subcutaneous tissues — the ink between the needles is drawn into them by capillary action. In short, the surface tension and forces holding the ink together encourages the ink to seep into the holes left by the needles.
As someone who's spent about 11 hours total on the receiving end of a tattoo machine, I can tell you that it's pretty cool to watch -- even without being an inch away from the needles.
You can learn more about tattooing (placement, process, and even different styles) by checking out this interactive. And for some basics on what you should know before getting your first tattoo, watch the video below.