The superposition principle is a property of a linear system/function/algebra. If the function f is linear, then if
This is the superposition principle and it works for any sort of linear or approximately linear problem. Electromagnetism and quantum mechanics are linear. More specifically, the electric field is a linear function of the charge distribution.
So, if you know the electric field for two charge distributions, you can easily figure out the electric field for the combined charge distribution.