My question is: When determining the equation of a cubic function, we can separate the general cubic equation into it's solutions and we end up with the equation
$y = a(x-r_1)(x-r_2)(x-r_3)$
We would then substitute the "roots" or solutions of the function and one other point to determine the original equation of the function.
However if we have only two roots and obviously one of those roots is a turning or stationery point as well, how do we derive the solution formula to be
$y=a(x-r_1)^2 (x-r_2)$?

The real-number version of the Fundamental Theorem of Algebra implies that if $P(x) = ax^3 + bx^2 + cx + d$ where $a$, $b$, $c$, and $d$ are all real numbers and $a \neq 0$, then at least one of the following statements is true:
\begin{align} P(x) &= a(x - r_1)(x - r_2)(x - r_3) &\quad&\text{where $r_1$, $r_2$, and $r_3$ are real numbers, or}\\ \\ P(x) &= a(x - r)(x^2 + px + q) &\quad&\text{where $p$, $q$, and $r$ are real numbers}\\ &&\quad&\text{and $x^2 + px + q$ has no real roots.} \end{align}
One implication of "$x^2 + px + q$ has no real roots" is that $x^2 + px + q$ is not equal to any product $(x - r_2)(x - r_3)$ for any real numbers $r_2$ and $r_3$. Another implication is that $P(x)$ has exactly one root, and that the slope of the tangent to the graph of $y = P(x)$ is positive where it crosses the $x$-axis.
But let's consider only cubic polynomials that can be written in the form $P(x) = a(x - r_1)(x - r_2)(x - r_3)$ using only real numbers. Suppose each of the numbers $r_1$, $r_2$, and $r_3$ is different from the other two. Then $P(x) = 0$ at three different values of $x$, namely, when $x = r_1$, when $x = r_2$, and when $x = r_3$.
If $P(x)$ has exactly two real roots, then it cannot be one of the polynomials that has a factor $x^2 + px + q$ with no real roots, so there must be real numbers $r_1$, $r_2$, and $r_3$ such that $P(x) = a(x - r_1)(x - r_2)(x - r_3)$. But $r_1$, $r_2$, and $r_3$ cannot be three different numbers (since $P(x)$ does not have three distinct roots), hence two of them must be the same. (They cannot all be the same, or $P(x)$ would have only one root.) Now relabel the symbols $r_1$, $r_2$, and $r_3$ so that the two equal numbers are labeled $r_1$ and $r_3$. That is, $r_3 = r_1$, and so
$$P(x) = a(x - r_1)(x - r_2)(x - r_3) = a(x - r_1)^2(x - r_2).$$
The original question did not ask which of the roots ($r_1$ or $r_2$) was the "turning point" in the case of exactly two real roots, and the derivation above did not make any use of the fact that there is a "turning point" in the function, but it is easy enough to show that a turning point exists and there is one at $r_1$ (the double root). One way is to take the first and second derivatives of $P(x)$, that is, find $\newcommand{\d}{\mathrm d} P'(x) = \frac{\d}{\d x} P(x)$ and $P''(x) = \frac{\d^2}{\d x^2} P(x)$; then show that $P'(r_1) = 0$ and $P''(r_1) \neq 0$ (hence, a turning point at $r_1$) whereas $P'(r_2) \neq 0$ (hence no turning point at $r_2$).
Another way is to consider arbitrary values $x_1$, $x_2$, and $x_3$ such that $x_1$, $r_1$, $x_2$, $r_2$, and $x_3$ are strictly ordered (either all in increasing sequence or all in decreasing sequence, and no two numbers in the sequence are the same). Then it is not hard to see that $x_1 - r_2$ and $x_2 - r_2$ have the same sign, while $(x_1 - r_1)^2$ and $(x_2 - r_1)^2$ are both positive, so $P(x_1)$ and $P(x_2)$ have the same sign (which is the sign of $a(x_2 - r_2)$). On the other hand, $x_2 - r_2$ and $x_3 - r_2$ have opposite signs, while $(x_2 - r_1)^2$ and $(x_3 - r_1)^2$ are both positive, so $P(x_2)$ and $P(x_3)$ have opposite signs. Hence we start on one side of the $x$-axis at $(x_1,P(x_1))$, meet the $x$-axis at $(r_1,P(r_1)) = (r_1,0)$, and then return to the same side of the $x$-axis as before (at $(x_2,P(x_2))$) without touching the $x$-axis at any other point between $x_1$ and $x_2$. So we must approach the $x$-axis from $x_1$ to $r_1$, touch the axis, and then from $r_1$ to $x_2$ we must turn back to the same side of the axis from which we came. On the other hand, from $x_2$ to $r_2$ to $x_3$ we cross the $x$-axis, and since we touch the axis only once in that interval it must be a crossing without "turning back".