There are three parts of your ear. The outer ear, the middle ear, and the inner ear. The outer ear is made of cartilage, which gives its shape and stiffness. The purpose of the outer ear is to catch sound waves so that they can go down the auditory canal, which is also considered part of the outer ear.
The middle ear contains the ear drum and three bones called the malleus, incus, and stapes. Also, part of the middle ear is the eustachian tube, which connects to the throat. The ear drum and the three bones serve to amplify the sound and move it to the inner ear. The eustachian tube's purpose is to regulate pressure in the ear. Sometimes, when you go up a mountain, you might feel the need to yawn because the pressure outside the ear is different from the pressure inside the ear. When you yawn, the pressure regulates and causes your ears to "pop".
The inner ear contains the cochlea, which is a snail-shaped tube full of liquid. The cochlea is where sound vibrations get turned into electrical impulses which are sent to your brain. The inner ear also contains three tubes called semicircular canals, which are full of liquid. These semicircular canals tell your brain in which direction you are moving. One detects left-right movement (y-axis), another detects up-down movement (z-axis), and another detects forwards-backwards movement (x-axis).