Answer
$n=\dfrac{-1\pm\sqrt{1+8S}}{2}$
Work Step by Step
$S=\dfrac{n(n+1)}{2}$; for $n$
Multiply the whole equation by $2$:
$2S=n(n+1)$
Evaluate the product on the right:
$2S=n^{2}+n$
Rewrite the equation like this:
$n^{2}+n-2S=0$
Solve for $n$ using the quadratic formula, which is:
$n=\dfrac{-b\pm\sqrt{b^{2}-4ac}}{2a}$
For this particular equation, $a=1$, $b=1$ and $c=-2S$
$n=\dfrac{-1\pm\sqrt{(1)^{2}-4(1)(-2S)}}{2(1)}=\dfrac{-1\pm\sqrt{1+8S}}{2}$