  Relating microscopic interactions to macroscopic observables is a central
challenge in the study of complex systems. Addressing this question requires
understanding both pairwise and higher-order interactions, but the latter are
less well understood. We present a unified mathematical formalism for deriving
higher-order interactions from macroscopic observables, relative to a chosen
decomposition of the system into its parts. Applying this framework to a
diverse range of systems, we demonstrate that many existing notions of
higher-order interactions, from epistasis in genetics and many-body couplings
in physics, to synergy in game theory and artificial intelligence, naturally
and uniquely arise from an appropriate mereological decomposition through the
M\"obius inversion theorem. By revealing the common mathematical structure
underlying seemingly disparate phenomena, our work highlights the fundamental
role of decomposition choice in the definition and estimation of higher-order
interactions. We discuss how this unifying perspective can facilitate the
transfer of insights across domains, guide the selection of appropriate system
decompositions, and enable the search for new notions of interaction. To
illustrate how this works in practice, we derive a new decomposition of the
Kullback-Leibler divergence, and show that it correctly disentangles
divergences among the variables of simulated spin models. Our results suggest
that the M\"obius inversion theorem provides a powerful and practical lens for
understanding the emergence of complex behaviour from the interplay of
microscopic parts, with applications across a wide range of disciplines.
