Integral representation of Airy Ai
Theorem
The Airy Ai function $$\mathrm{Ai}(z)=\dfrac{1}{2 \pi i} \displaystyle\int_{-i\infty}^{i \infty} e^{-zt + \frac{t^3}{3}} \mathrm{d}t$$ solves the Airy differential equation and moreover, if $z=x$ is a real number then $\mathrm{Ai}(x)$ is a real number and $$\mathrm{Ai}(x)=\dfrac{1}{\pi} \displaystyle\int_{0}^{\infty} \cos \left( xu + \dfrac{u^3}{3} \right) \mathrm{d}u.$$
Proof
Suppose that $y$ has the form $$y(z) = \displaystyle\int_{C} f(t)e^{-zt} dt,$$ where $C$ is an as-of-yet undefined contour in the complex plane. Assuming that we may differentiate under the integral it is clear that $$y^{\prime\prime}(z)=\displaystyle\int_{C} f(t)t^2 e^{-zt} dt.$$ Thus we plug this representation into the differential equation to get $$(*) \hspace{35pt} y^{\prime\prime}(z)-zy(z) = \displaystyle\int_{C} (t^2-z)f(t)e^{-zt} dt = 0.$$ Now we integrate by parts to see $$\begin{array}{ll} \displaystyle\int_{C} zf(t)e^{-zt} dt &= -\displaystyle\int_{C} f(t) \dfrac{d}{dt} e^{-zt} dt \\ &= -f(t)e^{zt} \Bigg |_{C} + \displaystyle\int_{C} f^{\prime}(t)e^{-zt} dt. \end{array}$$ We will pick the contour $C$ to enforce $f(t)e^{zt} \Bigg |_{C}=0$. We will do this by first determining the function $f$. Plugging this back into the formula $(*)$ yields $$\begin{array}{ll} 0 &= y^{\prime\prime}(z) - zy(z) \\ &= f(t)e^{zt} \Bigg |_{C} + \displaystyle\int_{C} (t^2f(t)-f^{\prime}(t))e^{zt} dt. \end{array}$$ We have the freedom to choose $f$ and $C$. We will choose $f$ so that $$t^2f(t)-f^{\prime}(t)=0.$$ This is a simple differential equation with general solution $$f(t)=\xi e^{\frac{t^3}{3}},$$ for some constant $\xi$ (later when we define $\mathrm{Ai}$, the convention is to choose $\xi=\dfrac{1}{2\pi i}$, but we will proceed the argument right now as if $\xi=1$). So we have derived $$y(z)=\displaystyle\int_{C} e^{-zt + \frac{t^3}{3}} dt.$$ To pick the contour $C$ note that the integrand of $y$ is an entire function and hence if $C$ is a simple closed curve we would have $y(z)=0$ for all $z \in \mathbb{C}$.
The variable of the integral defining $y$ is $t$ and for $t \in \mathbb{C}$ with $|t|$ very large, the cubic term in the exponent dominates. Hence consider polar form $t=|t|e^{i\theta}$ and compute
$$e^{\frac{t^3}{3}} = \exp\left( \frac{|t|^3 e^{3i\theta}}{3} \right).$$
Notice that the inequality $\mathrm{Re} \hspace{2pt} e^{3i\theta} \leq 0$ forces $\cos(3\theta)\leq 0$ yielding three sectors defined by $\theta$:
$$-\dfrac{\pi}{2} \leq \theta \leq -\dfrac{\pi}{6},$$ $$\dfrac{\pi}{6} \leq \theta \leq \dfrac{\pi}{2},$$ $$\dfrac{5\pi}{6} \leq \theta \leq \dfrac{7\pi}{6}.$$
We will consider three contours $C_1,C_2,C_3$, where each contour $C_i$ has endpoints at complex $\infty$ in different sectors. Call the left sector $\gamma$, the upper-right sector $\beta$ and the lower-right sector $\alpha$. Let $C_1$ be oriented from sector $\alpha$ to sector $\beta$ (this sort of curve is labelled as "$C$" in the image above), $C_2$ from sector $\beta$ to sector $\gamma$, and $C_3$ from sector $\gamma$ to sector $\alpha$. By our analysis we have derived three solutions to Airy's equation: $$y_i(z) = \displaystyle\int_{C_i} e^{-zt + \frac{t^3}{3}} dt;i=1,2,3$$ Since these functions satisfy a second order differential equation, it is impossible for them to be linearly independent. Now notice that we can compute $$\displaystyle\int_{C_1\cup C_2 \cup C_3} e^{-zt + \frac{t^3}{3}} dt = 0.$$ Therefore $$y_1(z)+y_2(z)+y_3(z)=0.$$
By convention we define $$\mathrm{Ai}(z) = \dfrac{1}{2\pi i} \displaystyle\int_{C_1} e^{-zt + \frac{t^3}{3}} dt,$$ where we take $C_1$ to be, specifically, the contour from $-i\infty$ to $i\infty$ along the $y$-axis in the complex plane. Hence we may compute by the substitution $u=it$ (hence $t=-ui$), $$\begin{array}{ll} \mathrm{Ai}(z) &= \dfrac{1}{2 \pi i} \displaystyle\int_{-i\infty}^{i \infty} e^{-zt + \frac{t^3}{3}} dt \\ &= \dfrac{1}{2\pi i} \displaystyle\int_{\infty}^{-\infty} (-i) e^{zui+\frac{(-ui)^3}{3})} du \\ &= \dfrac{1}{2\pi} \displaystyle\int_{-\infty}^{\infty} e^{i(zu + \frac{u^3}{3})} du \\ &= \dfrac{1}{2\pi} \displaystyle\int_{-\infty}^{\infty} \cos\left( zu + \dfrac{u^3}{3} \right) + i \sin \left( zu + \dfrac{u^3}{3} \right) du. \end{array}$$ Now if $z=x$ is a real number, then notice that $$\displaystyle\int_{-\infty}^{\infty} \sin \left( xu + \dfrac{u^3}{3} \right) du = \displaystyle\lim_{b \rightarrow \infty} \int_{-b}^b \sin \left( xu + \dfrac{u^3}{3} \right) du = 0,$$ because $xu+\dfrac{u^3}{3}$ is an odd function of $u$. Hence we see that $\mathrm{Ai}$ is real-valued at real-valued inputs. This insight yields the real-valued formula for $\mathrm{Ai}$ for $z=x$ a real number: $$\begin{array}{ll} \mathrm{Ai}(x) &= \dfrac{1}{2\pi} \displaystyle\int_{-\infty}^{\infty} \cos \left( xu + \dfrac{u^3}{3} \right) du \\ &= \dfrac{1}{\pi} \displaystyle\int_{0}^{\infty} \cos \left( xu + \dfrac{u^3}{3} \right) du, \end{array}$$ using the fact that the cosine function is even.█