I was wondering if the equation 1) is correct in this example. The author described the difference between equations for $X(w)$ and $X[k]$. The only difference I see is the $\frac{1}{T}$ coefficient. Thus I can't see where $w$ comes from in eq. 1) denominator, or small $t$ in its middle part. Shouldn't it be a big $T$?
Now assuming that indeed ${|X[k]|}^2$ equals the energy contained at that frequency of periodic signal. How could we use the relation between equations for $X(w)$ and $X[k]$ to derive eq. 2)? I'm not sure how we know that ${|X[w]|}^2$ represents density of a non-periodic signal. Isn't it just equal to energy contained at frequency $w$ multiplied by $T^{2}$, where $T \to \infty$?

Source: http://fourier.eng.hmc.edu/e101/lectures/handout3_tex.pdf
The notation is really confusing. It took a while for me to understand. But he is talking about units in 1).
So [XX] refers to the unit of XX.
Essentially he is saying, the unit of the continuous spectrum (X[w]) is the unit of the discrete spectrum (X[k]) times the unit of time ([t]), or divided by the unit of frequency ([w]). That is a rather obvious statement, and has nothing to do with 2).
So 1) and 2) are in my opinion totally unrelated. Probably this is where the confusion is coming from.