If $X_1, \ldots, X_n$ are the numbers selected, $S_n = \sum_{k=1}^n X_k$ so
$\text{Var}(S_n) = \sum_{i=1}^n \sum_{j=1}^n \text{Cov}(X_i, X_j)$. There are
just two cases to consider, $i=j$ (which occurs $n$ times) and $i \ne j$ ($n^2 - n$ times), so
$\text{Var}(S_n) = n \text{Var}(X_1) + (n^2-n) \text{Cov}(X_1,X_2)$.
$X_1$ is equally likely to be any of $1,2,\ldots,N$. Write $X_1 = \sum_{i=1}^N
i I_{\{X_1 = i\}}$ where $I_E$ denotes the indicator of event $E$ (i.e. $1$ if $E$ occurs, $0$ if not). We have $E[I_{\{X_1=i\}}] =E[I_{\{X_1=i\}}^2]= 1/N$
so $\text{Var}(I_{\{X_1=i\}}) = 1/N - 1/N^2$, while $I_{\{X_1=i\}} I_{\{X_1=j\}} = 0$ for $i \ne j$ so $\text{Cov}(I_{\{X_1=i\}}, I_{\{X_1=j\}}) = - 1/N^2$ for $i \ne j$. Thus $$\text{Var}(X_1) = \sum_{i,j} i j \text{Cov}(I_{\{X_1=i\}}, I_{\{X_1=j\}}) = \sum_{i=1}^N \dfrac{i^2}{N} - \dfrac{1}{N^2} \sum_{i=1}^N \sum_{j=1}^N ij = \dfrac{N^2-1}{12}$$
Similarly, $E[I_{\{X_1=i\}} I_{\{X_2=j\}}] = \dfrac{1}{N(N-1)}$ for $i\ne j$, $0$ for $i=j$, so $$\text{Cov}(I_{\{X_1=i\}}, I_{\{X_2=j\}} = \cases{\dfrac{1}{N(N-1)} - \dfrac{1}{N^2} = \dfrac{1}{N^2(N-1)} & for $i \ne j$\cr - \dfrac{1}{N^2} & otherwise}$$
so
$$ \text{Cov}(X_1,X_2) = \sum_{i=1}^N \sum_{j=1}^N \dfrac{ij}{N^2(N-1)} - \sum_{i=1}^N \dfrac{i^2}{N(N-1)} = -\dfrac{N+1}{12}$$
and thus
$$ \text{Var}(S_n) = n \dfrac{N^2-1}{12} - (n^2-n) \dfrac{N+1}{12} = \dfrac{n (N+1)(N-n)}{12} $$