I'm wondering which substitution I need to transform the integral below like the integral in the definition of the beta function (I know that $a>-1$ and $b>-1$, and $n \in \mathbb{N}$):
$$ \int_0^2 z^{n-a-2} (2-z^{-1})^b dz $$
I tried the substitution $y=z/2$, but I got an integral where there is the term $\frac{1}{2y}$ which is difficult to manage:
$$ \int_0^2 z^{n-a-2} (2-z^{-1})^b dz = 2 \int_0^1 (2y)^{n-a-2} \left(2-\frac{1}{2y}\right)^b dy = 2^{n-a-1} \int_0^1 y^{n-a-2} \left(2-\frac{1}{2y}\right)^b dy $$
Your integral is a special case of the incomplete beta function:
$$ I = \int_{0}^{2} z^{n-a-2}\left(2-\frac{1}{z}\right)^b dz = \int_{0}^{2} z^{n-a-2-b}(2z-1)^b dz$$
Making the substitution $ w = 2z$
$$ I = \frac{(-1)^b}{2^{n-a-1-b}} \int_{0}^{4} w^{n-a-2-b}(1-w)^b dw$$
The incomplete beta function is defined by
$$ B(v;\mu; x) = \int_{0}^{x} t^{v-1}(1-t)^{\mu-1}dt \quad 0\leq x<1\quad \mu \in \mathbb{R}, v >0 $$
However, if $\mu$ is a positive integer, an extension to arguments exceeding unity is possible:
$$B(v;m;x+1) = \frac{(m-1)!}{(v)_{m}} -(-1)^{m}B\left(m;1-v-m;\frac{x}{x+1}\right) \quad x\geq 0 \quad m=1,2,3,...$$
where
$(v)_{m} = v(v+1)(v+2)\cdots(v+m-1)$ is the rising factorial or Pochhammer polynomial.
Applying this extension to your integral and supposing $b+1\in \mathbb{Z}^{+}$:
$$ I = \frac{(-1)^b}{2^{n-a-1-b}} \left[ \frac{b!}{(n-a-b-1)_{b+1}} -(-1)^{b+1}B\left(b+1; 1-n+a; \frac{3}{4} \right)\right] $$
Therefore, if $ b+1\in \mathbb{Z}^{+}$ and $n-a-1-b>0$:
$$\boxed{\int_{0}^{2} z^{n-a-2}\left(2-\frac{1}{z}\right)^b dz = \frac{(-1)^b}{2^{n-a-1-b}} \left[ \frac{b!}{(n-a-b-1)_{b+1}} -(-1)^{b+1}B\left(b+1; 1-n+a; \frac{3}{4} \right)\right]}$$