I understand the confusion, as the “multiple definitions” of density of states can be pretty weird.
Here is a rather long and rigorous way to derive the given formula. It is not the fastest, nor prettiest, but for me it explained a lot.
For a system of length L with periodic boundary conditions we have that
k_n=\frac{2\pi n}{L}, \qquad n\in\mathbb Z .
The density of states tells us how many different k-states have an energy E. We can write this as a sum over n as followed:
g(E)=\sum_{n=-\infty}^{\infty}\delta\!\bigl(E-E(k_n)\bigr).
Check: Do you see why this counts the number of states which have the same energy E?
Because the allowed k-values are equally spaced (as we saw in the earlier weeks of the course),
\frac{dk}{dn}=\frac{2\pi}{L},
\qquad\Longrightarrow\qquad
\sum_{n}\longrightarrow\int dn
=\frac{L}{2\pi}\int_{-\infty}^{\infty}dk.
Therefore we can express the sum over n as an integral:
g(E)=\frac{L}{2\pi}\int_{-\infty}^{\infty}
dk\;\delta\bigl(E-E(k)\bigr).
Now comes the tricky part. In most courses where we get introduced to the delta function we just have linear arguments. But now we have something of the form f(x)=\delta(g(x)). In this case the function gives a nonzero f(x) if g(x)=0, which happens for some undetermined amount of roots x_i, and 0 for all other x. Mathematically this means that (for one root)
\delta(g(x))=\frac{\delta\!\bigl(x-x_0\bigr)}
{|g'(x_0)|}
For multiple roots, we just sum over all the roots.
(See proof: https://proofwiki.org/wiki/Composition_of_Dirac_Delta_Distribution_with_Function_with_Simple_Zero/Proof_1)
For the function f(k)=E-E(k) that has simple roots k_i=k_i(E) (from setting f(k) to 0), this becomes
\delta(f(k))=\sum_i\frac{\delta\!\bigl(k-k_i\bigr)}
{|f'(k_i)|}
\delta\bigl(E-E(k)\bigr)=
\sum_i\frac{\delta\!\bigl(k-k_i(E)\bigr)}
{\Bigl| -\,\dfrac{dE}{dk}(k_i)\Bigr|}.
Substituting this back into the integral
g(E)=\frac{L}{2\pi}\sum_i\int dk\;
\frac{\delta\!\bigl(k-k_i(E)\bigr)}
{\bigl|\,\dfrac{dE}{dk}(k_i)\bigr|}
=\frac{L}{2\pi}\sum_i
\frac{1}{\bigl|\,\dfrac{dE}{dk}(k_i)\bigr|}.
We previously defined the group velocity as v_g(k)=\frac{1}{\hbar}\frac{dE}{dk} so \left| \frac{dE}{dk}(k_i)\right|=\hbar\,|v_g(k_i)|.
Therefore we arrive at the formula from the lecture notes.
g(E)=\frac{L}{2\pi\hbar}
\sum_{k_i(E)}\frac{1}{|v_g(k_i)|}.
Now we see what we actually sum over. We sum over the the distinct solutions for E(k)=E. Not all possible k.