Consider a horizontal beam of length $L$ along the x-axis with vertical displacement $v$. Also consider that is has an applied load $P$ at $\frac{L}{2}$:
$$\dfrac{d^2v(x)}{dx^2} = \dfrac{M(x)}{EI}$$
Start with finding the moment in terms of x. You should know that the moment reaction on the left end is $-PL/8$ and the force reaction is $P/2$ so for $ 0 \le x \le L/2$ the moment function is:
$$M(x) - \dfrac{PL}{8} + \dfrac{P}{2}x = 0$$
$$M(x) = \dfrac{PL}{8} - \dfrac{P}{2}x$$
Integrate once:
$$\dfrac{d^2v(x)}{dx^2} = \dfrac{PL}{8EI} - \dfrac{P}{2EI}x$$
$$\dfrac{dv(x)}{dx} = \theta(x) = \dfrac{PL}{8EI}x - \dfrac{P}{4EI}x^2 + C_1$$
We know that the slope, $\theta(x)$, at either end is zero because the ends are fixed which gives us the condition $\theta(0)=0$:
$$\theta(0) = 0 + 0 + C_1$$
$$\therefore C_1=0$$
$$\therefore \theta(x) = \dfrac{PL}{8EI}x - \dfrac{P}{4EI}x^2$$
Integrate again:
$$v(x) = \dfrac{PL}{16EI}x^2 - \dfrac{P}{12EI}x^3 + C_2$$
We know the displacement at either end is zero so that gives the condition $v(0)=0$:
$$v(0) = 0 + 0 + C_2$$
$$\therefore C_2 = 0$$
$$\therefore v(x) = \dfrac{PL}{16EI}x^2 - \dfrac{P}{12EI}x^3$$
$$ = \dfrac{Px^2}{48EI}(3L-4x)$$
This equation only applies between $ 0 \le x \le L/2$ but the example is symmetric.