Question: How to derive this formula? 

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

Answer: 
$$\sum\_{k=1}^n(2k-1) = \sum\_{k=1}^n 2k + \sum\_{k=1}^n - 1 = 2\sum\_{k=1}^nk - n = 2\dfrac{n(n+1)}{2} - n = n^2 $$
As stated above, it can be proven by Mathematical Induction or by simple algebraic manipulation.
But there is other technique that is less rigorous but makes it obvious why it is true:
'Proof' by picture, look at the slide named "Sum of the Odd Integers": <http://math.berkeley.edu/~rbayer/09su-55/handouts/ProofByPicture-printable.pdf>