Direct Method

Let $T$ be the time period of $x(t)$ and $w_0=\frac{2\pi}{T} \Rightarrow w_0T=2\pi$. Now from the equation 1 lets expand the exponential term as follows:-

${....,e^{-j2w_0t},e^{-jw_0t},1,e^{jw_0t},e^{j2w_0t},....}$

So, this can be written in the form as given below:-

(1)
\begin{aligned} \int_{0}^{T}e^{jmw_0t}e^{-jlw_0t}dt &=\int_{0}^{T}e^{j(m-l)w_0t}dt \nonumber &=\bigg[\frac{e^{j(m-l)w_0t}}{j(m-l)w_0}\bigg]_{0}^{T} \nonumber &=\frac{e^{j(m-l)w_0t-1}}{j(m-l)w_0} \nonumber \end{aligned}

Remember, m and l are integers. So ,

$e^{j(m-l)w_0T}=e^{j(m-l)2\pi}=1$

Therefore,

(2)
\begin{align} \int_{0}^{T}e^{jmw_0t}e^{-jlw_0t}dt = \begin{cases} 0 & \text{if}\ m\neq l \\ T & \text{if}\ m=l \end{cases} \end{align}

Hence,

(3)
\begin{aligned} \int_{0}^{T}x(t)e^{-jlw_0t}dt &= \int_{0}^{T}\sum_{k=-\infty}^{\infty} X[k]e^{jkw_0t}e^{-jlw_0t}dt \nonumber &= \sum_{k=-\infty}^{\infty}\int_{0}^{T} X[k]e^{j(k-l)w_0t}dt \nonumber &= \sum_{k=-\infty}^{\infty}X[k]\int_{0}^{T} e^{j(k-l)w_0t}dt \nonumber \end{aligned}

Substituting the value from equation 3,

$\int_{0}^{T}x(t)e^{-jlw_0t}dt=X[l]T$

So,the analysis equation is given by:-

(4)
\begin{align} X[k]=\frac{1}{T}\int_{0}^{T}x(t)e^{-jkw_0t}dt \end{align}