The stress-energy tensor is given by $T(z) = \frac{1}{\alpha'} :\partial X(z) \partial X(z):$ , the normal-ordered product of the two given operators.
Thus taking the OPE of the stress-energy tensor with itself: \begin{align} T(z)T(w) &= \frac{1}{\alpha'^{2}} :\partial X(z) \partial X(z)::\partial X(z) \partial X(z):\\ &= \frac{2}{\alpha'^{2}} \left( \frac{-\alpha'}{2} \frac{1}{(z-w)^{2}}\right)^{2} + \frac{4}{\alpha'^{2}} \left( \frac{-\alpha'}{2} \frac{\partial X(w) \partial X(w)}{(z-w)^{2}}\right) + ...\\ &= \frac{1/2}{(z-w)^{4}} + \frac{2T(w)}{(z-w)^{2}} + \frac{2\partial^{2}X(w) \partial X(w)}{(z-w)} + ... \end{align}
On the second line the first term has a factor of $2$ because there are two ways of performing Wick contractions $\partial X(z) \partial X(w)$ and $\partial X(z) \partial X(w)$. The factor of $4$ in the second term on the second line is due to 4 ways of a making a single contraction. The part where I am confused is how on the third line one obtains the third term. Where does this come from? I could pull a clever trick, as in Ginsparg, and Taylor expand in terms of T(w) to obtain the correct 3rd term, but I want to obtain this in terms of the Wick contraction. Perhaps I am forgetting some things with respect to Wick contractions. I am a little uncertain of why I would have a second-order derivative in the third term in the 3rd line.
Now OPEs only make sense when viewed as operator insertions inside correlation functions, though for correlation functions I thought all of the terms must have undergone a contraction or else the correlation function was equal to zero. It does not seem as though this is true for an OPE, as the second term in the third line is obtained via a a single Wick contraction where as the other two terms in the first line are not contracted. Could someone also explain this distinction to me?