Computing expectation Suppose $X_{i}$, $i=1,2,...$ be independent variables taking values 1 and -1 with prob $P(X_{i})=\dfrac{1}{2}$. Let $S_{n}=\sum_{i=1}^{n} X_{i}$.
 I want to compute $E[(\sum_{i=1}^{n} X_{i})^2]$ but I don't see how to do this. 
 A: Here are 2 more approaches: 
Distributional Method
If $Z$~Bernoulli($\frac12$), then $X=2Z-1$ has your Rademacher distribution where $X=-1$ or $1$ with equal probability. Let $X_1, ..., X_n$ denote indepedent Rademacher random variables. Then, the pmf of:
$$ S_n \; =  \; \sum_{i=1}^n X_i \;  = \;  (2 \sum_{i=1}^n Z_i) - n \;  = \; 2 Y -n$$
where $Y$~ $Binomial(n,\frac12)$ (since the sum of $n$ Bernoulli's is $Binomial(n,p)$). Then, your problem reduces to finding an expectation of a Binomial random variable $Y$:
$$E[S_n^2] \; = \; E[(2 Y -n)^2] \; = \; n$$
Moments of Moments Method
Alternatively, this is a simple case of the much more general problem of finding 'moments of moments'. In particular, for any distribution whose moments exist:  
$$\text{Let } s_1 = \sum_{i=1}^{n} X_i \text{ .} \quad \text{   Then: } \quad E[s_1^2] = n(n-1) (E[X])^2 + n E[X^2]$$ 
[ see, for instance, expectation of sample sum squared ]
For your Rademacher random variable, $E[X^2]=1$ and $E[X]=0$, so the answer reduces to $n$.
A: $\begin{align}\mathsf E(X^2) & = \mathsf E(\sum_i X_i \sum_j X_j) \\ & = \sum_i \mathsf E(X_i^2)+\sum_i \sum_{j\neq i} \mathsf E(X_iX_j) \\ & = n\,\mathsf E(X_i^2)+n(n-1)\, \mathsf E(X_iX_j) \end{align}$ 
Now $\mathsf E(X_i^2) = (p\; (1)^2+(1-p)\;(-1)^2) \\\qquad = 1$
And when $i\neq j$ then $\mathsf E(X_iX_j) = p^2 (1)^2+2p(1-p)(1)(-1)+(1-p)^2(-1)^2 \\ \qquad = 4p^2 -4p+1$
So when $p=\tfrac 12$ then $$\begin{align}\mathsf E(X^2) & = n+n(n-1)\,(1-4p+4p^2) \\ & = n+n(n-1) (1-2+1) \\ & = n\end{align}$$ 
