A middle ear infection occurs behind the eardrum. It is most often caused by a virus or bacteria. Most kids have at least one middle ear infection by the time they are 3 years old. But adults can also get them.