How does a touchscreen know where you tapped?
Most modern touchscreens use capacitive sensing. Your finger, being electrically conductive, disrupts a tiny electrical field that the screen constantly projects across a grid of transparent electrodes. The screen measures exactly where that disruption occurs by detecting changes in capacitance at specific row and column intersections, then calculates the precise coordinates of your touch.
Older or simpler screens use resistive technology instead, where two flexible conductive layers are pressed together by your finger, completing a circuit at that exact point. The screen measures the resulting voltage to determine location. Capacitive screens are more accurate and support multi-touch because they can detect multiple disruptions simultaneously, which is why they became the standard for smartphones and tablets.