Echoes work through the reflection of sound waves. When a person shouts into a well or canyon, and they hear an echo, it is because the sound waves reflect from the canyon wall or the bottom of the well and travel back to the person's ears.
An echo works by initially producing sound, which is done by rushing air from the lungs past the vibrating vocal chords. The vibrations of the vocal chords cause the rushing air to fluctuate, which creates a sound wave. Essentially, a sound wave is just one particular moving pattern of fluctuations in air pressure.
The changing air pressure of the sound wave pushes out surrounding air particles and then pulls them in. These particles then push and pull the particles next to them, causing the sound wave to travel. When a person shouts, the sound wave produced travels across an area. The moment that the sound wave meets a solid, such as a rock face in a canyon, changing air pressure is reflected back, and the sound wave moves in the opposite direction towards the person who initially made the sound.
In certain areas, where air pressure and air composition are constant, it's possible to determine distance, such as the width of a canyon or the depth of a well.