Sum (sigma symbols) in LaTeX

Symbol Command
$\sum$ \sum
$\sum_{n=1}$ \sum_{n=1}
$\sum_{n=1}^{\infty}$ \sum_{n=1}^{\infty}
\[
\sum_{k=1}^{n} k^2 = \frac{1}{6} n (n+1) (2n+1)
\]

\[ \sum_{k=1}^{n} k^2 = \frac{1}{6} n (n+1) (2n+1) \]

\[
\frac{ \sum_{k=1}^{n} k^2 }{ 5 }
\]

\[ \frac{ \sum_{k=1}^{n} k^2 }{ 5 } \]

\[
\sum_{
    \substack{
        n \in \Lambda \\
        0 \lt i \lt n
    }
} f_{n} (a_{i})
\]

\[ \sum_{ \substack{ n \in \Lambda \\ 0 \lt i \lt n } } f_{n} (a_{i}) \]

LaTeX sum

LaTeX