I was given a proof for $E(X+Y)$ = $E(X)+E(Y)$ for cases where both variables are either discrete or continuous:
Discrete:
$$ \begin{align*} E(X+Y) &=\sum_{x\in\mathcal X}\sum_{y\in\mathcal Y}(x+y)p_{X,Y}(X=x, Y=y)\\ &= \cdots \end{align*}$$
Continuous:
$$ \begin{align*} E(X+Y) &=\int_\mathcal X\int_\mathcal Y(x+y)f_{X, Y}(x, x)dxdy\\ &=\cdots \end{align*} $$
I am not sure how they get double sums or double integrals from the definition of $E(X)$ with a single sum or integral. What is the intuition behind it or is there some mathematical logic behind it?
I know that for one discrete random variable $X$ where $x_1, x_2, \cdots$ are the values of $X$ and $p_X(x)$ is the probability mass function of $X$:
$$E(X)=\sum_{x\in\mathcal X}x_ip_X(x_i)$$
and likewise for one continuous random variable, with $f_X(x)$ being the probability density function for $X$:
$$E(X)=\int_{\mathcal X}x_if_X(x_i)\,\text{d}x_i$$
I am not sure how to get the double sums or integrals from the definitions I have given.