Sharks' snouts are covered in sensory organs called Ampullae of Lorenzini. They use these to detect electrical fields emitted by their prey, which is helpful in the case of hammerheads, who often prey on stingrays and crustaceans that might be hidden from sight by sand on the bottom. The easiest way to think about it is like a sort of "radar" system.
Hammerheads' name-giving snout shape allows for a greater level of accuracy when using these to detect prey. Because their electroreceptors are spread out in this pattern, they can more easily triangulate the location of their prey to an insane degree of accuracy.