I have always been fascinated by how a test pen works – since 12 years old, heck, i even tried to power up one with 2 AA batteries in series at age of 12!
As i found it tough to explain how it works, i been having this idea to draw it out in 3D, so finally i did it! Since this is related to high voltage stuffs, do read the disclaimer at the bottom of this page.
Look at the picture below, we have a test pen that light up when in contact with a "LIVE" or "HOT" wire, what's the magic behind it?
See picture below for the “BIG” picture. Through the body capacitance the AC current completed its path to Earth wire or Neutral wire, and light up the neon light inside the test pen.
In the picture, note that there are wires being routed inside the wall, floor, or ceiling, and in some cases the metallic piping under the floor will provide the return path for AC current as well.
See diagram below for the equivalent circuit:
Lots more info at link below: