\(a+b=a^2+b^2\ge\frac{\left(a+b\right)^2}{2}\Rightarrow a+b\le2\)
\(S=\frac{a}{a+1}+\frac{b}{b+1}\le\frac{1}{4}\left(\frac{a}{a}+\frac{a}{1}+\frac{b}{b}+\frac{b}{1}\right)=\frac{1}{4}\left(2+a+b\right)\le\frac{1}{4}\left(2+2\right)=1\)
\(S_{max}=1\) khi \(a=b=1\)