Let's write the function as $f(x,k)$. For $k = 0$, the polynomial $f(x,0) = - 2 x^{n-1} - 1$ has no positive roots. For $k = 1$, $f(x,1) = x^n - 3 x^{n-1} - 2$ has a real root greater than $3$. For $k = 2$, $f(x,2) = x^{n-2} (x^2 - 2 x - 1) - 4 > 0$ if $x \ge 3$ and $n \ge 3$. For $k = n$, $f(x,n) = x^{n-1}(x - 2) - 1 - 2^n > 0$ if $x \ge 3$ and $n \ge 3$. Now $f(x,k)$ is a concave function of $\log_2(k)$ for fixed $x > 1$, so $f(x,k) > 0$ if $x \ge 3$, $n \ge 3$ and $2 \le k \le n$. Thus if $n \ge 3$, the greatest real root of $f(x,k)$ for integers $0 \le k \le n$ occurs at $k=1$.