since $x_1^2+x_2^2+\cdots+x_n^2=1$ is the n-sphere,a compact set,so $S$ has a maximal(minimal) value. But when I try to solve it using the Lagrangian multiplier method, I don't know how to solve these equations. Clearly $x_1=x_2=x_3=\cdots = x_n=\frac{1}{\sqrt{n}}$ is an extremal point, but I don't know if it's the maximal(minimal) value. I want to know how to solve the problem. Also, could this problem be solved by elementary methods, like some inequality techniques?