The wiki outlines the combat mechanics quite well and is based on the source code. It’s mostly but not strictly additive.
For attack and defence the formula is:
Base unit stat) * (1 + tech bonus + terrain bonus + cultural bonus + tactic bonus) * (1 + leader trait bonus + tactical affinity bonus).
Note that martial skill also affects leader traits - at 20 martial the trait bonus is doubled and negative impacts removed (so defender gives 40% bonus to defence and no penalty to attack).
Interestingly it means that combat tactics and affinity multiply. And these + leader traits are far more important than cultural, retinue and terrain bonuses.