In which cases is it allowed to distribute integration/differentiation sign over an infinite sum? Per se, to perform the following operation(analogically for the differentiation as well). $$\int\sum_{i=1}^\infty f_i(x) dx\ =\sum_{i=1}^\infty \int f_i(x) dx\ $$
Particularly it is quite popular to apply this rule to the expansion of geometric series: e.i. $ \frac{1}{1-x}$
Note:
I know that it can happen that all member functions of the series to be differentiable, yet the sum be nowhere differentiable(Weierstrass function) or even vice versa. So I am wandering if there is a theorem or a heuristic according to which one can decide whether that operation is allowed to perform or not.