Moment of inertia is the name given to rotational inertia, the rotational analogue of mass for linear motion.
When the mass is left to descend after winding, there is a loss in potential energy Ploss.
$$P_{loss}=mgh$$
This is converted into three energies:
The flywheel’s kinetic energy, Kf, given by:
$$K_f=\frac{1}{2}Iω^2$$
The vertical kinetic energy of falling mass, Km:
$$K_m=\frac{1}{2}mv^2$$
Loss due to frictional torque, Wf:
$$W_f=\frac{n}{2N}Iω^2$$
Equating energies,
$$P_{loss}=K_f+K_m+W_f$$
$$⇒mgh=\frac{1}{2}Iω^2+\frac{1}{2}mv^2+\frac{n}{2N}Iω^2$$
$$⇒mgh= \frac{1}{2}Iω^2+\frac{1}{2}mω^2r^2+\frac{n}{2N}Iω^2$$
$$⇒mgh= \frac{1}{2}Iω^2+\frac{1}{2}mω^2r^2+\frac{n}{2N}Iω^2$$
$$I=\frac{Nm}{N+n}\left[\frac{2gh}{ω^2}-r^2\right]$$