The brilliant move here is not the computation but the contour we chose. Consider a counter composed of 3 parts: in the complex plane. Let be the horizontal section on the real axis from . Let be the counterclockwise rotation by . And be the line from the ending point of to the origin. So is a piecewise smooth simple closed curve.
Thus, consider .
By the residue theorem we have,
Now the only pole within the contour is when by de Moiver's theorem. The residue is .
Since this "error term" goes to zero.
Thus, as ,
The point of this is that you (Krizalid) should learn Complex Analysis as quickly as possible if you wanna do some nice integrals.