How does this continuity/mains tester work?
It's an LED turned on by a transistor!   The base (gate?) lead connects to the screwdriver blade.   Yes, all sorts of tricks and useful applications are possible with something this simple.

The resistor is a few-KVs high-volt type, probably chosen out of extreme safety paranoia (since customers might use it on a 440V breaker or worse.  Can't have resistor arcing over internally!)

If the transistor is a JFET or an hfe~5000 Darlington, the ohms value can be extremely high: turn on 1mA LED using 50v signal input, Base resistor can be

50v/(1mA/5000) = 250meg

and 250v/250meg = 1uA, so it's pretty safe, electrocution-wise, plus offering lots of ESD protection to the transistor.

Try sweeping the driver blade across cloth or plastic sheet while touching the button.  If the LED flickers, then the transistor is probably a JFET.