In order for an animal to hear sound they need a way of sensing its energy and translating that energy to nerve impulses.
Animals have different sensors based on their environment.

Ear Drum
Terrestrial animals have tympanic membranes that respond to pressure variations in air and convert them to mechanical movement sensed by hair cells and auditory nerves in the ear.

Lateral Line
Many marine animals have “mechanoreceptors” that sense motion, including acoustical particle motion through cilia or “hair cells” on their body, like the line down teh sides of a fish.
© Encyclopaedia Britannica, Inc.

Motion Sensor
Many fish have free moving bones or “otoliths” in their heads that help sense body motion including motion caused by acoustical particle motion.

Acoustical lipids
Dolphins and porpoises have fatty “acoustical lipids” in their jaws that receive sounds and channel the sounds to their inner ears.
ILLUSTRATION: whaleresearch.com