Binaural Localization   

Our ability to locate the source of a sound in three dimensional space is known as binaural localization and is based on cognitive processing of differences in intensity, time, and frequency colouration between the two ears. 
 
Interaural intensity differences between the two ears are the result of the acoustic shadow created by the head for frequencies in the middle to high frequency range. 

If, for instance, a sound comes from a source to the left of the head the left ear will receive the sound directly while the right ear will not receive the direct sound due to it being in the acoustic shadow of the head. Instead, the right ear will receive reflections from surrounding surfaces. These reflections of the direct sound will have been attenuated as a result of the absorptive characteristics of the surface material. The greater intensity of sound reaching the left ear results in the perception of the sound originating from the left. 

Interaural time differences are short delays (up to approximately 0.6 milliseconds) in the time taken for a sound to reach the ear furthest from the sound source. 

This is a result of the distance between the two ears and the fact that sound will take slightly longer to reach the farther ear for any sound not equidistant from the two ears. This effect is more pronounced for lower frequencies and in combination with interaural intensity differences gives us a good sense of lateral location of sound sources. 

 
But what about perception of sound as emanating from above, behind, or below us?

This sense appears to be given by the action of the pinnae, the two ridges running along the edges of the outer ears. Sound is delayed between 10 to 300 microseconds by reflection off these ridges and combined with direct sound entering the ear to create phase cancellations with resulting frequency colouration of the sound. 

See also
 binaural recording.