The various causes of ear pain are almost too numerous to count: Middle ear infection (otitis media), mostly associated with infections (viral or bacterial) of the fluid in the middle ear. Infection of the ear canal (otitis externa), mostly associated with "swimmer's ear".
The most crucial step you can take in managing pain related to otitis media is by getting a proper diagnosis from your provider, and then, if necessary, using prescribed treatment. In the meantime, over-the-counter ibuprofen is usually effective. It also helps to prop your child into a more upright position to sleep at night, as this decreases pressure in the ears and, subsequently, pain.
Another treatment option for pain control is analgesic ear drops. These ear drops contain a local anesthetic, similar to lidocaine, which can be inserted directly into the ear. There are over the counter drops as well as prescription drops. Garlic drops are very effective.
Of note is that the American Academy of Pediatrics suggests that otitis media warrants treatment with antibiotics only if accompanied by a persistent fever of three days as many ear infections resolve spontaneously.