Here, I think this image explains it best, due to the missing strip of Sheetrock:
See those black dots? Those are screws, which are holding the Sheetrock onto the wooden studs (which you can see peeking through the horizontal gap in the Sheetrock). Once the wall is plastered and painted, the screws are not visible; but if not painted, each stud's location would be discernible by the telltale vertical line of screw-heads.
The fancy-shmancy tool in the person's hand is a "stud finder", that is designed to "sense" (using some creepy force like ultrasound, radar, x-ray, black magic, Kim Kardashian, etc.) when the space directly behind the Sheetrock underneath the tool's current location is hollow (between studs), and when not (a stud); however, a low-tech alternative is to simply use a magnet (such as the one in this lock set) to find one or more of the "invisible" (i.e. painted over) screw heads. Once you find a spot where the magnet sticks successfully (read: onto the head of a screw), you know there's a stud directly behind the magnet's location.
Capische?