They can feel the baby's head (or presenting part if it's not a head) with their fingers. With lots of experience they can sometimes tell what it is, and if it is the head, which way the baby is facing.