Ear infections generally occur in your middle ear. They can be bacterial or viral. Infections are often painful due to inflammation and buildup. An ear infection can cause discharge and you may notice a bad smell.