There are several different types of ear infections, and each one has a different effect on hearing.
Otitis Externa
An infection of the outer ear.
Hearing loss resulting from otitis externa is almost always the result of a blocked ear canal. This could be the result of a foreign agent, excessive earwax buildup, or even a fungal infection. If the infection is chronic, it may also trigger dermatitis, leading to the buildup of thick, scaly skin that causes a narrowing of the ear canal.
Otitis Media
An infection of the middle ear.
Inflammation of the eustachian tube can result in fluid buildup in the space behind the eardrum. This reduces the eardrum's capacity to transmit sound and, in extreme cases, impedes the motion of the ossicles. Children are typically more prone to this kind of infection due to both a less powerful immune response and a more horizontal eustachian tube.
In some cases, fluid or mucus may remain in the eustachian tube after the infection passes, a condition known as otitis media with effusion.
Otitis Interna
Inflammation of the inner ear. It's only the result of an infection roughly half the time. No one is certain of the cause in cases where a virus is not involved.
Otitis interna may also be known as labyrinthitis or vestibular neuritis. Hearing loss from this condition is typically caused when inflammation impairs the function of a critical organ or nerve of the inner ear.