When you chew gum or suck a pacifier, your mouth generates saliva, which you then swallow. That's what eases the ear pain, the swallowing. (Yawning will do it too, it moves the same muscles as swallowing.)
Give the child something to drink during takeoff and landing. Bring it on board with you, as the FA's will not serve you anything to drink until the plane is in the air, and by that time, it would likely be too late already. If you don't know if the child is prone to airsickness, I don't recommend dairy products; go with water or clear juices. (BTW, in children, the most likely time for airsickness to strike is just after landing; watch him carefully as the plane taxis to the gate.) The air in planes is very dry, anyway, so hydration is important.
If the little one is showing signs of sniffles in the days leading up to the trip, it's a good idea to give a decongestant to clear the Eustachian tubes in advance. For preventing ear or sinus pain, the best decongestant is going to be one that includes the ingrediant Guiafenesin, which is found in Robitussin and the generic equivalents of robitussin. Antihistamines don't work to prevent ear pain, in fact, they can make it worse, because they dry the inside of the ear, which causes the tissue to be less elastic, which, in turn, means that pressure on those tissues is going to be more painful than it would be if they were moist. To work well, guiafenesin requires good hydration, so again, push the liquids.
If he does end up in pain, call the FA to get you some coffee cups for his ears. They will know what you want. They get a couple of coffee cups, put paper napkins in them, and then pour in boiling water, enough to make the napkins damp. This means that the cups become little steam chambers. You use them to cover both ears. The steam will cause a pressure change inside the ear, which relieves the pain in about 3-5 minutes. Be VERY careful to turn the cups upside-down before putting them over his ears; you want to make sure that no hot water will dribble out and scald him or you.