When light hits a semiconductor, it creates additional electron-hole pairs. Generally, the minority carriers move to the surface, where they change the surface potential of the material. When the light is removed, the excess carriers recombine, and the surface potential returns to its equilibrium value. Thus, in p-type material a chopped light produces a negative going surface potential, because the minority carriers are electrons, and in n-type material a chopped light produces a positive going surface potential.
It is possible to sense the surface potential via a capacitive probe. The semiconductor surface is one plate of a capacitor, and an electrode inside the type tester is the other plate. In any capacitor, a sharp change in voltage on one plate causes an instantaneous sharp change in voltage at the other plate. Since we know the chopping frequency, we can use synchronous detection to detect very small signals at the electrode in the PN type tester. If the signal goes negative when the light is on, then the sample is p-type, and vice versa.