You are asking for isomorphism classes of split extensions $H$ of the module $N:=\mathbb{Z}/n\mathbb{Z}$ by the group $G:=\mathbb{Z}/2\mathbb{Z}$. This is a special case of a metacyclic group, by the way.

A first approximation is to determine all homomorphisms from $\mathbb{Z}/2\mathbb{Z}$ into the automorphism group $Aut(N)$ of $N$; each of these corresponds to a semidirect product (but we still might get some isomorphism classes multiple times). Now, it is well-known that $Aut(N)\cong \mathbb{Z}/\phi(n)\mathbb{Z}$, where $\phi$ denotes Euler's totient function.

Using the above (and the links I gave), it is not difficult to see that the 2-Sylow-subgroup $P$ of $Aut(N)$ is isomorphic to $(\mathbb{Z}/2\mathbb{Z})^m \times Aut(\mathbb{Z}/2^k\mathbb{Z})$, where $m$ equals the number of distinct odd primes divisors of $n$, and $2^k$ is the largest power of $2$ dividing $n$. If $k=0$ or $k=1$, then $P\cong(\mathbb{Z}/2\mathbb{Z})^m$. If $k>1$, then $P\cong (\mathbb{Z}/2\mathbb{Z})^{m+1} \times \mathbb{Z}/2^{k-2}\mathbb{Z}$.

Counting the number of homomorphisms from $G$ into this, then for $k=0$ or $k=1$ we get $2^m$; for $k=2$ we get $2^{m+1}$ and for $k>2$ we get $2^{m+2}$.

With some more effort, one proceeds to verify that each of these homomorphisms leads to a unique isomorphism class; for that, you essentially have to verify that $G$ either acts trivially or non-trivially on each $p$-Sylow-subgroups; and that it really has four non-isomorphic actions on $\mathbb{Z}/2^k\mathbb{Z}$ if $k>2$ (once you get an action like in a dihedral group, once like in a semidihedral / quasidihedral group; once as in the direct product; and one more).