Well, use Euler's formula: e iwt = coswt+I * sinwt, and you can get it by substituting this into the right.
Of course, it can also be obtained by substituting: cos wt = 1/2 * (e iwt+e (-iwt)) into the formula on the left.
The premise is to write the Fourier transform completely after writing, and you will know why.