We begin with the known Hamiltonian which is also the unperturbed $$\hat H^0\left|\ m\right>=E_m^0\left|\ m\right>$$ Now we introduce the perturbation $$(\hat H^0+\hat H')\left|\ m\right>=E_m^0\left|\ m\right>$$ If you are familiar with first order perturbation you must be knowing the first order correction in energy eigenvalue $$E_m^1= \left<\psi\right|\hat H'\left|\psi\right>$$ $$\hat{H}'=V_o \sum_{n=1}^{N-1}\delta(x-na)$$ $$E_m^1=\int_0^{Na} V_o \sum_{n=1}^{N-1}\delta(x-na) \sqrt \frac{2}{Na}\sin \frac{mx\pi}{Na}\sqrt \frac{2}{Na}\sin \frac{mx\pi}{Na}$$ $$E_m^1=V_o\int_0^{Na} \sum_{n=1}^{N-1}\delta(x-na) \frac{2}{Na}\sin^2 \frac{mx\pi}{Na} $$ $$E_m^1=\frac {2V_o}{Na}\int_0^{Na} \sum_{n=1}^{N-1}\delta(x-na) \sin^2 \frac{mx\pi}{Na} $$
$$E_m^1=\frac {2V_o}{Na}\int_0^{Na} \sum_{n=1}^{N-1}\delta(x-na)\frac{1}{2}\bigr ( 1- \cos2 \frac{mx\pi}{Na}) $$ Odd terms go to zero $$E_m^1=\frac {2V_o}{Na}\int_0^{Na} \sum_{n=1}^{N-1}\delta(x-na)\frac{1}{2} $$ $$E_m^1=\frac {V_o}{Na}\int_0^{Na} \sum_{n=1}^{N-1}\delta(x-na) $$ $$E_m^1=\frac {V_o}{Na}\int_0^{Na} \delta(x-a)+\delta(x-2a)+........\delta(x-(N-1)a) $$ $$E_m^1=\frac {V_o}{Na}\Bigr( \int_0^{Na} \delta(x-a)+\int_0^{Na}\delta(x-2a)+........\int_0^{Na}\delta(x-(N-1)a) \Bigr)$$ Now,if you use matlab or wolfram it would be easy to solve using the Heaviside step function or θ(x) $$\int\delta(x-tk)= \theta(x-tk)$$ Substitute this in the integral $$E_m^1=\frac {V_o}{Na}\Bigr( \theta(x-a)+\theta(x-2a)+........\theta(x-(N-1)a) \Bigr)\Bigr|_0^{Na}$$
$$E_m^1 =\frac {V_o}{Na}\sum_{n=1}^{N-1}\theta(x-an)\Big|0^{Na}$$ Let N be any positive number like 3 then $$\sum{n=1}^{N-1}\theta(x-an)\Big|0^{Na}=\sum{n=1}^{3-1}\theta(x-an)\Big|_0^{3a}$$ $$=\theta(x-a) + \theta(x-2a)+......\theta(x-(N-1)a)\Bigr|_0^{Na}$$ $$=\theta(Na-a) + \theta(Na-2a)+......\theta(Na-(N-1)a)-\theta(0-a) -\theta(0-2a)-......\theta(0-(N-1)a)$$ $$=\theta(a(N-1)) + \theta(a(N-2))+...... 526