How to derive the size of $k = \log n$ base from $\frac{1}{2^k} = O(\frac{1}{n})$?
Think about it if we remove the fraction. We need a $k$ large enough so that $2^k = O(n)$. We could do this simply by solving for $k$ in the expression $2^k = n$. Which is simply $k = \log_2 n$. This is because $2^{\log_2 n} = n$. 

Now apply the same logic to your expression, with $k = \log_2 n$ we see that: $$\frac{1}{2^{\log_2 n}} = \frac{1}{n} = O\left(\frac{1}{n}\right)$$