We know that the sum of first $n$ numbers is $\frac{n(n+1)}{2}$. So, I tried to derive it using the formula for sum of first $n$ odd numbers and sum of first $n$ even numbers. Here's what I did
What I tried was to split $$1+2+3+\dots + n$$ into $$(1+3+5+\dots + (2n-1))+(2+4+6+\dots + 2n)$$ We know that sum of first $n$ odd numbers is $n^2$ and sum of first $n$ even numbers is $n(n+1)$. So our expression breaks down to $n^2+n(n+1)$ Which is then equal to $n^2+n^2+n=2n^2+n$. But the sum of first $n$ numbers is $\frac{n(n+1)}{2}$ and $2n^2+n$ is not equal to it. Even if I factorize $2n^2+n$, I get $n(2n+1)$ And, if I equate it to $\frac{n(n+1)}{2}$, I get $n=\frac{-1}{3}$ which is not what I want. What I want to ask is that why Sum of first $n$ odd numbers and Sum of first $n$ even numbers does not help us to get the Sum of first $n$ numbers.
Thanks in advance
As Mark Bennet says, you are summing $2n$ numbers, not $n$ numbers.
To see why, you used $$(1 + 3 + 5 + \cdots + (2n - 1)) + (2 + 4 + 6 + \cdots + 2n).$$ Notice that the second part of the expression, $(2 + 4 + 6 + \cdots + 2n)$ in particular, is equal to twice the sum of the first $n$ numbers. This is because $$2 + 4 + 6 + \cdots + (2n - 2) + 2n$$ $$2(1) + 2(2) + 2(3) + \cdots + 2(n - 1) + 2(n)$$ $$2(1 + 2 + 3 + \cdots + (n - 1) + n)$$
For you to get the sum of the first $n$ numbers using the formula for odd and even numbers, you have to consider the case where $n$ is odd and $n$ is even. When $n$ is even, then $n$ can be represented as $2k$ where $k \in \mathbb{N}$. Then, there must be $k$ even numbers and $k$ odd numbers. Otherwise, there must be $k + 1$ odd numbers and $k$ even numbers.
To avoid confusion, we'll use $i$ as our variable here.
We know that $$1 + 3 + 5 + \cdots + (2i - 3) + (2i - 1) = i^{2}$$ and $$2 + 4 + 6 + \cdots + (2i - 2) + 2i = i(i + 1).$$
Let $n$ be the number of terms. This means that $n = 2k$ where $k \in \mathbb{N}$. Hence, we have $k$ even numbers and $k$ odd numbers. Getting the sum of $k$ even numbers and $k$ odd numbers, $$2 + 4 + 6 + \cdots + 2k = k(k + 1) \\ 1 + 3 + 5 + \cdots + 2k - 1 = k^{2}$$
Adding both the sums, $$k(k + 1) + k^{2} \\ k^{2} + k + k^{2} \\ 2k^{2} + k \\ k(2k + 1) \\ \frac{n}{2}(n + 1) \\ \frac{n(n + 1)}{2}$$
To solve this case, we will use the first case, and just add $2k + 1$. Hence, we have $n + 1$ terms. Then, $$k(k + 1) + k^{2} + 2k + 1 \\ k^{2} + k + k^{2} + 2k + 1 \\ 2k^{2} + 3k + 1 \\ (2k + 1)(k + 1) \\ (n + 1)\left(\frac{n}{2} + 1\right) \\ (n + 1)\left(\frac{n + 2}{2}\right) \\ \frac{(n + 1)(n + 2)}{2}$$
Our last expression seems to match the formula from the first case, only that $n$ became $n + 1$.