There may be a number of reasons for there to be pain in the ear when a throat infection is ensuing.
Initially there may be a perfectly logical explanation, i.e., that the Eustachian tube which runs from the middle ear cavity to the back of the nasopharynx and throat is blocked due to the infection which is appearing in the throat. If the tube is blocked then the natural drainage from the middle ear of mucus does not occur as it should. Normally, with a fully functioning Eustachian tube, every time you swallow or yawn, the isthmus (narrowest point) in the Eustachian tube opens via the tensor veli palatini muscle, which is also responsible for tensing of the soft palate of the mouth. Thus when you swallow the tube opens and shuts allowing mucus and air to flow through the tube and equalisation of pressure between the middle and outer ear.
When the tube is not functioning correctly due to too much mucus build up preventing it from opening, then there can be resulting pain in the ear. This pain tends to be from pressure, causing the ear drum, or tympanic membrane, to become distended. The reason for this change in pressure is due to the mucus in the middle ear cavity using up the oxygen in the small amount of air in the cavity. Normally the air is replaced every swallow or yawn, but when the tube is not functioning correctly the oxygen is quickly exhausted.
The other reason for the pain may be what is called referred pain. This is a more complicated issue which is related to the nerves in the head. There are twelve pairs of cranial nerves and some which innervate the throat run through the ear on their way to the neck. Nerves are very small and their ability to locate pain exactly can sometimes be a little poor. If there is severe pressure on a nerve in the throat due to swelling from an infection, this pressure and thus pain can be referred, by the nerve, to another location on it’s length. This can also happen with headaches and neck pains. If there is pressure on the nerve elsewhere then referred pain can occur.
If this is a problem which you are suffering form, I would advise you to see your audiologist or GP initially to confirm if the pain is in the ear due to Eustachian tube dysfunction or if it is indeed referred form elsewhere. The usual treatment for the tube dysfunction would be decongestant either in a medical form or that of steam inhalation, which helps to unstuck the tube and restore normal function. Referred pain would of course require treatment of the source not the location, i.e. the throat infection needs to be treated and not the ear pain.