There's a trig identity or two in there for you to check out. Here's a hint
2*sinx*cosx = sin2x
I'm not sure what the transition was between step 2 and step 3 (where step 1 is the very first thing written). There's probably some algebra in there that you'll have to do on your own. Try working backwards on it, you know that apparently (x^2 + 2x)/(3*sin(6x)) = (x^2 + 4x + 2)/(18*cos(6x)). The problem is a little fudgy looking, so I'm sorry if I misread a - sign as a +
The final step should be easy, in the most basic of terms you could just plug in 0 for every x and you'll get 2/18 = 1/9.