Concept: Separate the odd and even indexed terms and apply the standard sum of squares formula independently.
Step 1: For even \(n=2m\), \(S_{2m}=\sum_{k=1}^{m}(2k-1)^2+2\sum_{k=1}^{m}(2k)^2\). Using the identities for odd squares and square sums, \(S_{2m}=m(2m+1)^2=\dfrac{n(n+1)^2}{2}\).
Step 2: For odd \(n=2m-1\), subtract the last even term from \(S_{2m}\): \(S_{2m-1}=m(2m+1)^2-8m^2=m(2m-1)(2m)=\dfrac{n^2(n+1)}{2}\).
Step 3: Hence, \(\boxed{S_n=\begin{cases}\dfrac{n(n+1)^2}{2},&n\text{ even}\\[4pt]\dfrac{n^2(n+1)}{2},&n\text{ odd}\end{cases}}\).