2. $2n+1=k^2$
The left side is an odd number, so $k=2p+1$.
Then $2n+1=4p^2+4p+1\Rightarrow n=2p^2+2p\Rightarrow n+1=2p^2+2p+1=p^2+(p+1)^2$