Can an ac signal pass from ground( earth's surface) to the socket?
Neutral and ground in the socket are connected together in the breaker box in the house.  Ground is then connected to the literal ground beneath your feet.

You are connected to the ground - you are standing on it.  Even if you are standing on the floor of your house, it is still connected to the ground.

So, you touch the button the end of the tester.  You touch the other end to the live wire in the socket.  Current flows out of the live wire, though the tester (which lights up,) through you, through the floor, through the ground, through the house ground wire, then from there to the neutral, completing the circuit.



There are two things you need to remember when using a phase tester:


YOU are part of the circuit - this makes some people very nervous.  The current involved is very low, and the resistor in the tester is a carbon composition type that will fail open if it goes bad.  You cannot get shocked unless there is an extremely high voltage on the live wire - which could only be the case if the step down transformer feeding your house is defective.
If the ground connection through you is poor, then it will not show a live connection. This can be the case if you are standing on dry concrete or are otherwise well insulated from the ground (thick soled rubber shoes, etc.)


If something happens to cause a high enough voltage to be present that it could shock you, then probably every appliance and light bulb in your house will explode.  So, not a realistic problem.

As for the second point, you ALWAYS check first to see that the tester detects the live wire (it MUST light up when connected to a known live wire.) Then you turn off the circuit you intend to work on and test again.  If it was on before you shut off the circuit (at the circuit breaker in the switch box) and it was off after you turned off the breaker, then you can be certain that the tester is working and that the power is off.

When the power is off, you can short the live and ground to be doubly certain.  Nothing at should happen if the power is off.  If the power was still on, the short circuit will trip breaker and the power go off for sure.