I assumed from my general physics courses that the principle of superposition was just an empirical fact about forces. Then I could understand that derived quantities like the $E$ and $B$ fields would also obey it because, for instance: $$F_1 + F_2 = qE_1 + qE_2 = q(E_1+E_2) = F_{total} \\ \implies E_1 + E_2 = E_{total}$$But yesterday I saw that the Wikipedia page on gravitational potential stated that "the potential associated with a mass distribution is the superposition of the potentials of point masses." So apparently gravitational potential energy also obeys the superposition principle.
This leads me to wonder what all are the quantities that obey superposition. Do all types of energy obey it, for example? Better yet, is there some way of determining whether a given quantity (number/ vector/ etc) will obey the principle of superposition theoretically or do we need an empirical law for each?
Looking at the Wikipedia page on the superposition principle didn't help as it stated that all linear systems obeyed it. But how do we know whether a system is linear? I know how to determine whether a function is linear, but let's take for example gravitational potential energy: $$U_g = - \frac{GMm}{r}$$ This law has $3$ independent variables. It is linear in $M$ and $m$ but not in $r$. So how would I determine which of those variables needs to be linear for the gravitational potential energy to obey the principle of superposition?