Why must $n$ be even if $2^n+1$ is prime? This is a necessary step in a problem I am working on.

$n$ has to be a power of $2$. 
suppose $n$ is not a power of $2$, then let $n=dk$ with $d$ odd.
Then $2^n+1=(2^k)^d+1=(2^k)^d+1^d$ ,now use the high school factorization for $x^d +y^d$ which is true when $d$ is odd that says $x^d+y^d=(x+y)(x^{d-1}-x^{d-2}y+x^{d-3}y^2\dots +y^{d-1})$.
In this case $x=2^k$ and $y=1$.
We get:
$(2^k)^d+1=(2^k+1)((2^k)^{d-1}-(2^{k})^{d-2}+(2^k)^{d-3}\dots +1)$ This tells us our number is not prime.

Fenyang Wang gives a simpler way to prove the number must be even.
this is because if it was odd it would be a multiple of three, and the only prime multiple of three is three.
However it is useful to note the number has to be a power of two, since powers of two are a lot scarcer than even numbers. Also notice that in my solution you can exchange $2$ for any positive integer other than $2$.
