Question: How to derive this formula? 

$$n^2=\sum\_{k=1}^n(2k-1).$$

Answer: 
Well, since other had given formulae for calculating this sum, I will write a summing method from my primary school days: For $n=5$,

$$\begin{array}{c|c|c|c|c}
\times&\times&\times&\times&\times\\\hline
\color{red}\bigcirc&\color{red}\bigcirc&\color{red}\bigcirc&\color{red}\bigcirc&\times\\\hline
\times&\times&\times&\color{red}\bigcirc&\times\\\hline
\color{red}\bigcirc&\color{red}\bigcirc&\times&\color{red}\bigcirc&\times\\\hline
\times&\color{red}\bigcirc&\times&\color{red}\bigcirc&\times
\end{array}$$
for k=1,2,3,3............n
2(1)−1+2(2)−1+2(3)−1+…2(n)−1
=2(1)+2(2)+2(3)+⋯+2(n)−(1+1+…1)
=2(1+2+3+⋯+n)−n
sum of first natural natural numbers:-1+2+3+........+n
now if you can compute sum of first natural numbers, I don't think there would be any problem