After tests I have been able to uncover some easily calculated rules for catapult hits.
1) Surviving catapults do the damage. If you need 200 catapults to achieve certain level drop, that's the quantity that need to survive the battle. If attacker loses the battle (which means they lose all attacking catapults too), there will be no damage to the target building.
2) The (unmodified) quantity of catapults needed to drop down building levels in a single hit is determined by the hit points of each building and its current level. The hit points are listed for each building level at the
wiki. For example if Headquarters is at level 15, 11 catapults will drop it by one level and 22 catapults by two levels. If Headquarters is at level 30, 72 catapults will drop it by one level and 144 catapults by two levels.
3) If catapults (after modifers) are in between levels to drop based on hit points, the closest level down or up will decide what the final building level will be after the hit. For example if level 15 headquarters is hit by 17 catapults (modifier = 1.0), it will come down two levels even though the nominal quantity of catapults needed is 22. A church has 800 hit points at each level. 401 catapults (after modifiers) will drop a church down by one level and 399 catapults will not bring it down at all.
4) Modifiers (luck, morale, faith, wall, officers) and paladin weapon affect the catapult strength (by modifying the hitting quantity used in the calculation) in a linear way. For example to bring a church of an empty village down when attacker's modifier is 100% and defender has a level 20 wall (modifier 200%), 803 catapults are needed. 2 catapults will die at the wall's basic defense and 801 will do the damage. 100%/200%*801=400,5 catapults that do the damage
5) Exceptions;
a) Barracks seems to have incorrect hit points on the wiki. It seems to behave like headquarters (including the support column bonus).
b) Hospital or chapel can not be damaged by catapults
c) Headquarters and farm cannot be damaged below level 1 by catapults.
Catapults don't generally need an escort (provided that they hit an empty village) since their attack power is 100 each. The same value of rams is 2, which is why they need escort or they will die at the wall's basic defense. Therefore it is not a problem to recruit catapults in a defensive village and this way save provisions of attacking villages.