When my daughter was around 3.5 and had been sick for a few days with ordinary but not severe cold-like symptoms, she was asleep in bed one night and suddenly began screaming and writhing while holding her ear. I had no idea what was happening, and although she was a precociously verbal child who would ordinarily have had the ability to articulate what was going on, she was in so much pain that she couldn't talk. As I was frantically looking for blood, or a bug bite, or anything that I might be able to see, her cries gradually subsided until she was able to tell me that something in her ear had "popped." I called our pediatrician's office to ask the doctor on call whether I should take her to the ER, and he told me that it was likely an ear infection, and that the build-up of fluid in her ear had finally caused the ear drum to burst. I thought that sounded AWFUL, like maybe her hearing could now be permanently damaged, but he assured me that the ear drum does heal, but that I should come into the office right away in the morning to have her ear examined and medication prescribed.
Sure enough, our pediatrician confirmed in the morning that her ear drum had burst because of a fluid build-up (I had no idea that she was even experiencing a fluid build-up!), and he prescribed an oral antibiotic as well as another antibiotic that had to be poured into her ear canal twice a day for 10 days with an eye dropper while she lay on her side, and then she had to stay like that for about 10 mins. so that the antibiotic would settle into her ear and not spill out. I would sit and read her books, so that made it more bearable for her, but honestly, it was awful. What kid that age would be okay with your pouring liquid into their ear and then their having to lie still for the next 10 minutes? Fortunately, we got through those days, but I hope to never repeat them.
It sounds like your daughter may have something similar going on. If so, hopefully you can get the problem diagnosed and addressed before her ear drum pops. It was awful to see my daughter experience that kind of agony, compounded by the fact that there was nothing I could do to help her.