Step question, locus of points where angle of elevation to tops of flagpoles is always the same 
The smooth and level parade ground of the First Ruritanian Infantry Divison is ornamented by two tall vertical flagpole of heights $h_1$ and $h_2$ a distance d apart. As part of an initiative test a soldier has to march in a such a way that he keeps the angles of elevation of the tops of the two flagpoles equal to one another. Show that if the two flag poles are of different heights he will march in a circle.


To celebrate the King's birthday a third flagpole is added. Soldiers are then assigned to each of the three different pairs of flagpoles and are told to march in such a way that they always keep the tops of their two assigned flagpoles at equal angles of elevation to one another. Show that, if the three flagpoles have different heights $h_1, h_2$ and $h_3$ and the circles in which the soldiers march have centres at $(x_{ij},y_{ij})$ (for the flagpoles of height $h_i$ and $h_j$) relative to Cartesian coordinates fixed in the parade ground, then $x_{ij}$ satisfy
$$h_3^2(h_1^2-h_2^2)x_{12}+h_1^2(h_2^2-h_3^2)x_{23}+h_2^2(h_3^2-h_1^2)x_{31}=0.$$
Deduce that the three centres lie in a straight line.

The question is much shorter than it looks. The first part is easy, by drawing a quick diagram you get that, with coordinates relative to one of the flagpoles and both of flags on the $y$-axis,
$$(h_1^2-h_2^2)x^2+(h_1^2-h_2^2)y^2-2h_1^2dx+h_1^2d^2=0$$
as the locus of the soldiers. For the second part I'm pretty sure you just have to use this equation three times. Completing the square gives the centre of the circle having coordinates $\left(\frac{dh_1^2}{h_1^2-h_2^2},0\right)$ i.e. a distance $\frac{d_{12}h_1^2}{h_1^2-h_2^2}$ along the line connecting pole 1 and 2 where $d_{12}$ is the distance between them(and analogous equations can be written down the other pairs of poles). However, this isn't really $x_{12}$ due to our choice of axes, we can only say, in terms of vectors
$$(x_{12},y_{12})=X_1+\frac{dh_1^2}{h_1^2-h_2^2}{(X_2-X_1)}$$
where $X_1$ is the absolute position vector of the first flag pole, $X_2$ of the second. Writing down the equations of this form for the other circles gives a nasty system of vector equations, which you could probably solve to eliminate $X_1,X_2,X_3$, but have no hope of getting rid of $d_{12}$ et al. and is no way the question is supposed to be approached. There is a "model" answer here if this has some more details that may be useful to you, but it is totally unintelligible to me.
I would like to know how to proceed in generalising the first result as is required, to get the required answer. The question is question 7 here  should it be needed.
EDIT:
I have solved the question in the manner set out above(thanks to a comment below), I will let the bounty go to the most upvoted answer(of which all so far have been wonderful) in a couple of days
 A: What we will show: If we square the heights of the flagpoles, then the line requested in the problem is the line where the plane containing the three new flagpole tops meets the ground.
Caveat: This solution is clearly not the one intended by the problem author, and it does not proceed via the big equation given in the problem. It does not even use any particular coordinate system.
Part 1: The soldier marches in a circle
Let's start by confirming that the soldiers march in circles.
We will assume all flagpoles have unequal heights.
If flagpole $A$ is twice as high as flagpole $B$, then the soldier $S$ must be twice as far from $A$ as from $B$ for the flagpoles to appear to be the same height (meaning that the angles of elevation to the tops of $A$ and $B$ are the same).
More generally,
if flagpole $A$ has height $a$ and flagpole B has height $b$,
and we write $\overline{SA}$ for the distance from $S$ to $A$,
then we have
$\overline{SA}\,/\,a = \overline{SB}\,/\,b$,
Squaring this we get
$ \overline{SA}^2 \,/\, a^2 = \overline{SB}^2 \,/\, b^2 $.
We can think of $ \overline{SA}^2 $ as a function of $S$,
which, if we plot it, is a paraboloid centered at $A$.
Recall some trivial paraboloid facts:
Paraboloids are quadratics with the same coefficient for $x^2$ as for $y^2$, so if we add or subtract two paraboloids, we get another paraboloid.
(Or a plane, if the resulting quadratic coefficient is zero.)
Also, multiplying a paraboloid by a constant yields another paraboloid.
If the quadratic coefficient is negative, the paraboloid curves down instead of up.
(If you are familiar with mass points,
paraboloids (ignoring their constant term) are just like mass points,
regarding addition and multiplication.)
If we rewrite our equation as
$\frac{1}{a^2} \overline{SA}^2 - \frac{1}{b^2} \overline{SB}^2 = 0$,
we see that the left hand side is a paraboloid.  (Not a plane, since $a≠b$.)
The desired locus of points is those points $S$ for which this paraboloid equals zero. Since paraboloids are circularly symmetric, every level plane of a paraboloid is a circle, so this confirms that the soldier marches in a circle.
Part 2: Where is the center of the circle?
By symmetry,
when we add two paraboloids $G$ and $H$,
the center of $G+H$ must lie on the line connecting the centers of $G$ and $H$.
Where on this line will it lie?
If we look at the paraboloid's height along this line,
it is the sum of the contribution from $G$ (which is a parabola)
and the contribution from $H$ (another parabola),
so the sum is also a parabola.
The center of $G+H$ lies at the extremal point of this parabola.
If we look at the line $AB$ so $B$ is to the right of $A$,
we can consider the slope of the summed parabola
$\frac{1}{a^2} \overline{SA}^2 - \frac{1}{b^2} \overline{SB}^2$,
so as to find its extremal point by finding where the slope is zero.
At point $A$, the contribution from $A$'s parabola has slope 0,
so the slope of the sum is determined by $B$'s parabola,
whose slope there is $\frac{2 \overline{AB}}{b^2}$.
Similary, at $B$, the slope is $\frac{2 \overline{AB}}{a^2}$.
We can linearly extrapolate from these two slopes to find the extremum,
since the slope of a parabola varies linearly.
The extremum yields the center of the circle where the soldier is marching.

(Again, if you are familiar with mass points,
this diagram just shows regular 1-D mass point addition
of a negative mass $\frac{-b^2}{2 \overline{AB}}$ at $A$ and a positive mass $\frac{a^2}{2 \overline{AB}}$ at $B$.)
This figure gives the impression of being yet another diagram of two flagpoles!
Multiplying the y-axis by
$\frac{a^2 b^2}{2 \overline{AB}}$
makes the height over $A$ be $a^2$,
and makes the height over $B$ be $b^2$,
while leaving the circle center (the x-intercept) unchanged.

Part 3: Collinearity of the circle centers
This follows immediately.
If we square the heights of the three flagpoles, then each circle center lies at the point $S$ from which the new flagpole tops appear (to the soldier) to coincide, as in the diagram above.
So the line requested in the problem is the line where the plane containing the three new flagpole tops meets the ground.
A: Let us try to understand this using the answer you have mentioned.
First of all, you seems to have solved the first part and have got the right answer. As mentioned in your solution, let $X_1, X_2, X_3$ be the position vectors of the flag poles and $h_1, h_2, h_3$ be their respective heights.
According to your solution, if $X_1 = (0,0)$ and $X_2 = (d,0)$ then the position vector of the centre of the corresponding circle formed is $v_{12} = \left( \frac{d {h_1}^2}{{h_1}^2 - {h_2}^2}, 0 \right)$. Thus, the ratio between the distance of $X_1$ and $v_{12}$, and the distance between $X_2$ and $v_{12}$ is $$\frac{{h_1}^2}{{h_1}^2 - {h_2}^2} : \frac{-{h_2}^2}{{h_1}^2 - {h_2}^2}$$ This can be calculated by taking the difference of corresponding position vectors and taking the ratio of coordinates. Note that the ratio does not depend on $d$, as you seems to have indicated in your calculaton of $(x_{12},y_{12})$. The negative sign in the ratio just indicates that the point $v_{ij}$ is not BETWEEN the points $X_i$ and $X_j$, but still on the line joining them. Especially, this does not make our calculations wrong.
The observation about the ratio can be extended to the other two pairs also, by changing the variables appropriately.
Denoting the (position vector of the) centre of circle corresponding to $X_i$ and $X_j$ by $v_{ij}$, we get that the corresponding ratio between distances to the $v_{ij}$ is
$$m_1 : m_2 = \frac{{h_i}^2}{{h_i}^2 - {h_j}^2} : \frac{-{h_j}^2}{{h_i}^2 - {h_j}^2}$$
By section formula,
$$\begin{equation} \begin{aligned}
 v_{ij} &= \frac{m_1 X_2 + m_2 X_1}{m_1 + m_2} \\
&=  \frac{{h_i}^2 X_j - {h_j}^2 X_i }{{h_i}^2 - {h_j}^2}
\end{aligned} \end{equation}$$
Thus, $${h_k}^2 ({h_i}^2 - {h_j}^2) v_{ij} = {h_k}^2 {h_i}^2 X_j - {h_k}^2 {h_j}^2 X_i$$
Summing over the appropriate indices $i,j$ and $k$, we get that the right hand terms all get cancelled.
$$h_3^2(h_1^2-h_2^2)v_{12}+h_1^2(h_2^2-h_3^2)v_{23}+h_2^2(h_3^2-h_1^2)v_{31}=0$$ The required equation is the $X$-coordinate of LHS. Similarly, using Y-coordinates instead, we get the corresponding equation in $Y$- coordinates.
Now to note that the three centres lie on a straight line, note that $ v_{12}$ is the point that divides the line joining $v_{23}$ and $v_{13}$ in the ratio $${h_1}^2 ({h_2}^2 - {h_3}^2) :{h_2}^2 ({h_3}^2 - {h_1}^2)$$ using the equation(s) that we just obtained. This means that the three centres lie on a straight line.
A: $\def\vec{\overrightarrow}\def\paren#1{\left(#1\right)}$These circles are in fact Apollonius' circles. To avoid the complexity introduced by the specific choice of the coordinate system, it is easier to work with vectors first and derive the coordinate result at the end.
Suppose the pole with height $h_i$ is at point $P_i$, and denote the circle corresponding to pole $i$ and $j$ by $ω_{i, j}$. Suppose $ω_{i, j}$ meets line $P_i P_j$ at point $Q_{i, j}$ and $R_{i, j}$ where $Q_{i, j}$ is on the segment $P_i P_j$, then\begin{gather*}
\frac{\vec{P_i Q_{i, j}}}{\vec{Q_{i, j} P_k}} = \frac{h_i}{h_j} = -\frac{\vec{P_i R_{i, j}}}{\vec{R_{i, j} P_k}}, \tag{1}
\end{gather*}
and the midpoint of $Q_{i, j} R_{i, j}$ (denote by $M_{i, j}$) is the center of $ω_{i, j}$. If $O$ is the origin of the plane, then (1) implies that$$
\vec{OQ_{i, j}} = \frac{h_j}{h_i + h_j} \vec{OP_i} + \frac{h_i}{h_i + h_j} \vec{OP_j},\quad \vec{OR_{i, j}} = \frac{-h_j}{h_i - h_j} \vec{OP_i} + \frac{h_i}{h_i - h_j} \vec{OP_j},
$$
thus\begin{gather*}
\vec{OM_{i, j}} = \frac{1}{2} (\vec{OQ_{i, j}} + \vec{OR_{i, j}}) = \frac{-h_j^2}{h_i^2 - h_j^2} \vec{OP_i} + \frac{h_i^2}{h_i^2 - h_j^2} \vec{OP_j}. \tag{2}
\end{gather*}
Therefore,\begin{gather*}
h_3^2 (h_1^2 - h_2^2) \vec{OM_{1, 2}} + h_1^2 (h_2^2 - h_3^2) \vec{OM_{2, 3}} + h_2^2 (h_3^2 - h_1^2) \vec{OM_{3, 1}}\\
= h_3^3 (-h_2^2 \vec{OP_1} + h_1^2 \vec{OP_2}) + h_1^3 (-h_3^2 \vec{OP_2} + h_2^2 \vec{OP_3}) + h_2^3 (-h_1^2 \vec{OP_3} + h_3^2 \vec{OP_1}) = \mathbf{0}, \tag{3}
\end{gather*}
which implies that$$
h_3^2 (h_1^2 - h_2^2) x_{1, 2} + h_1^2 (h_2^2 - h_3^2) x_{2, 3} + h_2^2 (h_3^2 - h_1^2) x_{3, 1} = 0.
$$
Finally, note that\begin{gather*}
h_3^2 (h_1^2 - h_2^2) ≠ 0,\quad h_1^2 (h_2^2 - h_3^2) ≠ 0,\quad h_2^2 (h_3^2 - h_1^2) ≠ 0,\\
h_3^2 (h_1^2 - h_2^2) + h_1^2 (h_2^2 - h_3^2) + h_2^2 (h_3^2 - h_1^2) = 0,
\end{gather*}
so $M_{1, 2}$, $M_{2, 3}$, $M_{3, 1}$ are collinear by (3).

It is even more straight forward to prove collinearity from (2) by methods of geometry. Note that by (2),$$
\frac{\vec{P_i M_{i, j}}}{\vec{M_{i, j} P_j}} = -\frac{h_i^2}{h_j^2},
$$
thus$$
\frac{\vec{P_1 M_{1, 2}}}{\vec{M_{1, 2} P_2}} · \frac{\vec{P_2 M_{2, 3}}}{\vec{M_{2, 3} P_3}} · \frac{\vec{P_3 M_{3, 1}}}{\vec{M_{3, 1} P_1}} = \paren{ -\frac{h_1^2}{h_2^2} } \paren{ -\frac{h_2^2}{h_3^2} } \paren{ -\frac{h_3^2}{h_1^2} } = -1,
$$
which implies the collinearity of $M_{1, 2}$, $M_{2, 3}$, $M_{3, 1}$ by Menelaus' theorem.
