We take the real part because the differential equations governing the dynamics of the system were real to begin with (and so were the initial conditions). To put it simply, there is 'no way to add apples with apples and get oranges'.
To explain why taking the real part is okay, let's start with the (hopefully) familiar differential equation for the damped driven harmonic oscillator: $$\underbrace{m\ddot{x}}{\text{inertia}}=-\underbrace{m\omega_0^2x}{\text{spring force}}-\underbrace{m\gamma\dot{x}}{\text{damping}}+\underbrace{F\cos\omega{\text{d}} t}{\text{drive term}}.$$ Notice that this is a linear differential equation, meaning that only linear powers of $x$ and its time derivatives show up (no terms like $\sqrt{x},~x^2$, et cetera are present). The steady state solution to this differential equation is of the form $$x(t)=x_0 \cos(\omega{\text{d}} + \phi)$$ where $x_0$ and $\phi$ are the steady state amplitude and phase shift, respectively. Now you can plug this into our differential equation to arrive at equations for $x_0$ and $\phi$, but there is another approach based on complex exponentials which can greatly simplify the mathematics when the systems become more complicated (e.g. three coupled oscillators). 976
Things like differentiation, multiplication, and division are much simpler with exponentials than with $\sin$ and $\cos$. To see how this works for the problem at hand, let's create the complex variable $$\begin{align}z(t)&= x_0 \cos(\omega_{\text{d}} t + \phi) + i x_0 \sin(\omega_{\text{d}} + \phi) \ & = x_0 e^{i(\omega_d t+\phi)}\end{align}$$ where the last line is by <PERSON>'s formula. Notice that $x(t) = \text{Re}[z(t)]$ and that $F\cos\omega_{\text{d}} t = \text{Re}[F e^{i\omega_{\text{d}} t}]$, and therefore our differential equation is simply the real part of the complex differential equation $$m\ddot{z(t)}=-m\omega_0^2 z(t)-m\gamma\dot{z(t)}+Fe^{i\omega_{\text{d}} t}.$$ This is actually two differential equations: our original differential equation plus an imaginary one that we added. Because the differential equation for this system is linear, we don't have to worry about products between real (one we care about) and imaginary (one we invented) terms. Let me know if you are still confused about this. It trips up everyone when they first see it. 418