Solution:
Concept: The angle of elevation of a point above the observer is the angle between the horizontal line through the observer's eye and the line of sight to that point. The height, the horizontal distance and the line of sight form a right-angled triangle, so tan(elevation)=horizontal distanceheight.
Step 1 — Set up the picture.
Let the tower be BC (foot B, top C) with height H m, and the flagstaff CD on top of it with CD = h m. Let P be the point on the plane, d m from B. Then ∠BPC = α and ∠BPD = β.

Step 2 — Write the two tangents.
In right ΔPBC the tower H is opposite α; in right ΔPBD the whole height H + h is opposite β.
tanα=dH
tanβ=dH+h
Step 3 — Remove d.
From the first equation d = H ÷ tan α. We put this into the second equation.
tanβ=H(H+h)tanα
Now we multiply both sides by H.
Htanβ=Htanα+htanα
Step 4 — Make H the subject.
We collect the H terms on the left and take H out as a common factor.
Htanβ−Htanα=htanα
H(tanβ−tanα)=htanα
H=tanβ−tanαhtanα
Watch out: Β belongs to the TOP of the flagstaff, so its opposite side is H + h, not h.
Therefore, the height of the tower is tanβ−tanαhtanα. Hence proved.