Given 2 circles $(x - x_1)^2 + (y - y_1)^2 = r^2$ and $(x - x_2)^2 + (y - y_2)^2 = r'^2$
(with radii $r, r'$) coordinates of the internal and external centers of similitude $C_i, C_e$ are given by
$C_i = (\frac{x_1 \cdot r' + x_2 \cdot r}{r + r'}, \frac{y_1 \cdot r' + y_2 \cdot r}{r + r'})$ and $C_e = (\frac{x_1 \cdot r' - x_2 \cdot r}{r' - r}, \frac{y_1 \cdot r' - y_2 \cdot r}{r' - r})$
The diagram below shows that this is true, but I was wondering if anyone knows how to derive the equations?

Consider the two pairs of similar right triangles (red and blue) in the diagram.
Writing $C$ for either $C_{e}$ or $C_{i}$, we have $$\frac{|\overline{AC}|}{a} = \frac{|\overline{BC}|}{b} \qquad\to\qquad a\;|\overline{BC}| = b\;|\overline{AC}|$$
Since $A$, $B$, and $C$ are collinear, we can write coordinate-vector equations $$a\;(C-B) = \pm\;b\;(C-A)$$ (where "$\pm$" is "$+$" when $C=C_{e}$, and "$-$" when $C=C_{i}$, reflecting the fact that the vectors $AC$ and $BC$ point in the same, or in opposite, directions), so that $$C = \frac{aB\mp bA}{a\mp b} \qquad\to\qquad C_{e} = \frac{aB - bA}{a - b}\qquad C_{i} = \frac{aB + bA}{a + b}$$
Your formulas follow from substituting the circle centers $A =(x_1, y_1)$ and $B = (x_2,y_2)$ and radii $a=r$ and $b=r^\prime$.