How does averaging increase the Signal to Noise ratio? When attempting to spot activities on an EEG waveform given a stimuli, it is recommended that several trials be taken and their average is done to increase the SNR.

Intuitively, since noise is not stationary or localized, averaging different trials will have a smearing effect on the noise.

But how exactly does it increase the SNR since the noise is still present (but averaged out)? Can we more rigorously define the effect of averaging on the SNR?
Intuitively this is true, because averaging a zero mean noise processes approximates its expectation value - which is zero. More rigorously:

If the signal $x$ that you want to observe (estimate, actually) is constant for all observations $y$ we can write the $n\text{th}$ observation as
$$
y_n = x + r_n
$$
where $r_n$ is the noise which is different for every observation, of course. The SNR $\gamma_1$ of $y_n$ is
$$
\gamma_1=\frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]} 
$$
where $\operatorname{E}$ is the expectation operator. By averaging $N$ observations of $y_n$ we get
$$
\hat x = \frac{1}{N}\sum_{n=1}^N( x+r_n) = x + \frac{1}{N}\sum_{n=1}^N r_n
$$
The SNR $\gamma_2$ of the averaged observations is
$$
\gamma_2=\frac{\operatorname{E}[|x|^2]}{\frac{1}{N^2}\operatorname{E}[|\sum_{n=1}^N r_n|^2]} 
$$
To simplify that expression, we assume that the noise sequences $r_n$ are uncorrelated (1). In that case, the expectation of the squared sum of $r_n$ is equal to the sum of the expectations of the squared $r_n$, i.e.
$$
\operatorname{E}\left[|\sum_{n=1}^N r_n|^2\right] = \sum_{n=1}^N \operatorname{E}\left[|r_n|^2\right]=N\operatorname{E}\left[|r_n|^2\right]
$$
Inserting this in the expression for $\gamma_2$ yields
$$
\gamma_2=N \frac{\operatorname{E}[|x|^2]}{\operatorname{E}[|r_n|^2]}
$$
Comparing the SNR $\gamma_1$ of the single observation and the SNR $\gamma_2$ of the averaged observation we see that averaging increases the SNR by a factor of $N$.

(1) This holds for a Gaussian noise process, for example. Right now I'm not sure for what classes of stochastic processes it holds. Comments on this are welcome.