To prove that $f$ is injective for odd $n$, you need to show that $x^n=y^n$ implies that $x=y$ for all real values of $x$ and $y$. To prove that $f$ is not injective for even $n$, you need to show that there are real numbers $x$ and $y$ such that $x^n=y^n$ and $x\neq y$.
The first proof is not at all straightforward. First, note that it is only possible for $x^n$ to equal $y^n$ when $x$ and $y$ have the same sign, so we can disregard the case where $x$ is positive and $y$ is negative (and vice versa). Let's consider the case where $x$ and $y$ are both positive. Assume that $x^n=y^n$. Then, $x^n-y^n=(x-y)(x^{n-1}+x^{n-2}y+\dots+y^{n-1})=0$, and since the second bracketed term is positive, we must have $x=y$. I'll leave the case where $x$ and $y$ are both negative to you. Hint: if $x$ and $y$ are both negative, then $-x$ and $-y$ are both positive, so you can use the previous case to help you.
The second proof is much easier. Consider what happens when $x=1$ and $y=-1.$