Formula for molar specific heat capacity in polytropic process

That $C$ is the specific heat for the given cycle, i.e. $$dQ=nCdT$$ This is for $n$ moles of gas.(not the $n$ you stated in question)

I will assume $$PV^z=\text{constant}$$

$$nCdT=dU+PdV$$ $$\int nCdT=\int nC_vdT+\int PdV$$

$$nC\Delta T=nC_v \Delta T+\int \frac{PV^z}{V^z}dV$$

As numerator is a constant, take it out!

Also note that $$P_iV_i^z=P_fV_f^z$$

$i = \text{initial}$

$f=\text{final}$

Focusing on integral only,

$$PV^z\int V^{-z}dV$$

$$PV^z\left[\frac{V^{-z+1}}{-z+1}\right]^{V_f}_{V_i}$$

Note that the $PV^z$ is same for initial and final step. So, we multiply it inside and do this ingenious work:

$$-\frac{P_iV_i^zV_i^{-z+1}}{-z+1}+\frac{P_fV_f^zV_f^{-z+1}}{-z+1}$$

$$-\frac{P_iV_i}{-z+1}+\frac{P_fV_f}{-z+1}$$

Note that $PV=nRT$

$$\frac{nR\Delta T}{-z+1}$$

where $\Delta T=T_f-T_i$

Final equation :

$$nC\Delta T=nC_v \Delta T+\frac{nR\Delta T}{-z+1}$$

$$C=C_v+\frac{R}{1-z}$$

This will bring you the original equation, you can find $C_v$ by

$$C_p/C_v=\gamma$$

$$C_p-C_v=R$$

Using $C_p=\gamma C_v$,

$$C_v\left(\gamma-1\right)=R$$

$$C_v=\frac{R}{\gamma-1}$$

Substituting in original equation,

$$C=\frac{R}{\gamma-1}+\frac{R}{1-z}$$