[tex]f(x_1,\ldots,x_n)=x_1+\cdots+x_n=\displaystyle\sum_{i=1}^nx_i[/tex]
[tex]{x_1}^2+\cdots+{x_n}^2=\displaystyle\sum_{i=1}^n{x_i}^2=4[/tex]
The Lagrangian is
[tex]L(x_1,\ldots,x_n,\lambda)=\displaystyle\sum_{i=1}^nx_i+\lambda\left(\sum_{i=1}^n{x_i}^2-4\right)[/tex]
with partial derivatives (all set equal to 0)
[tex]L_{x_i}=1+2\lambda x_i=0\implies x_i=-\dfrac1{2\lambda}[/tex]
for [tex]1\le i\le n[/tex], and
[tex]L_\lambda=\displaystyle\sum_{i=1}^n{x_i}^2-4=0[/tex]
Substituting each [tex]x_i[/tex] into the second sum gives
[tex]\displaystyle\sum_{i=1}^n\left(-\frac1{2\lambda}\right)^2=4\implies\dfrac n{4\lambda^2}=4\implies\lambda=\pm\frac{\sqrt n}4[/tex]
Then we get two critical points,
[tex]x_i=-\dfrac1{2\frac{\sqrt n}4}=-\dfrac2{\sqrt n}[/tex]
or
[tex]x_i=-\dfrac1{2\left(-\frac{\sqrt n}4\right)}=\dfrac2{\sqrt n}[/tex]
At these points we get a value of [tex]f(x_1,\cdots,x_n)=\pm2\sqrt n[/tex], i.e. a maximum value of [tex]2\sqrt n[/tex] and a minimum value of [tex]-2\sqrt n[/tex].