How does a touchscreen know where your finger is?
Most modern touchscreens use capacitive sensing. Your finger conducts electricity, and when it touches the screen it disturbs a small electrical charge across a grid of transparent conductive material, usually indium tin oxide. Sensors at the edges measure exactly how much the charge changes at different points in the grid, and the processor calculates the precise location where the disturbance occurred.
Older resistive touchscreens worked differently, using two flexible layers that physically pressed together when touched, completing a circuit at that exact point. Capacitive screens are more accurate and can detect multiple fingers simultaneously because they measure the charge distortion across the whole grid at once rather than just detecting a single point of physical contact.