This is a cross-post of a question on MathOverflow where it didn't get much attention: https://mathoverflow.net/questions/337892/how-to-find-a-point-on-a-line-that-minimizes-sum-of-distances-from-three-given-p
Let there be given three points $x_1$,$x_2$,$x_3$ and a line $l$ on a plane. Does there exist an explicit method of finding such a point $p$ on $l$, that sum of distances of $p$ from $x_1$,$x_2$,$x_3$ is possibly minimal? Such result for two given points and a line is trivial and known as the Heron's theorem commonly used in optics to find a path of a ray of light.
All I know about the solution is that if $p$ minimizes the sum of distances, then $$\cos{\alpha}+\cos{\beta}+\cos{\gamma}=0$$
The equation above comes directly from the derivative of the function of sum of distances if we assume that the line has equation $y = 0$:
$$\frac{d}{dx} \sum_{i=1}^3 \sqrt{(x-x_i)^2+(0 - y_i)^2} = 0$$ $$\sum_{i=1}^3 \frac{x-x_i}{\sqrt{(x-x_i)^2+(y_i)^2}} = 0$$ $$\cos{\alpha}+\cos{\beta}+\cos{\gamma}=0$$
However, that is not really helpful neither for construction nor finding the solution analytically. Some rare situations may be solved using Brianchon's theorem.
That is, if we add symmetrical reflections of $x_1$,$x_2$,$x_3$ on the opposite sides of $l$ and the six points are vertices of a hexagon circumscribing a conic section, then the intersection of the main diagonals minimizes the sum of distances. However it is far from general solution.

There is no analytic solution in the present situation about standard special functions.
As already mentioned, the equation to solve for $x$ is : $$\sum_{i=1}^3 \frac{x-x_i}{\sqrt{(x-x_i)^2+(y_i)^2}} = 0$$ This equation can be transformed into a polynomial equation of degree higher than 5.
It is known that the general polynomial equations of degree up to 4 can be analytically solved in terms of a finite number of elementary functions.
The general polynomial equation of degree 5 cannot be analytically solved in terms of a finite number of elementary functions. It requires some special functions of Jacobi theta kind : http://mathworld.wolfram.com/QuinticEquation.html
In the case of the present problem, as far as I know there is no standard special function available to solve the related polynomial equation of high degree.
Thus don't expect an analytical solution with a finite number of standard functions.
In practice numerical calculus is easy. For example with data ( points in black) : $$(x_1=0\:,\:y_1=6.4)\:;\:(x_2=6\:,\:y_2=10)\:;\:(x_3=14.5\:,\:y_3=7.2)$$
The point noted $x$ drawn in black isn't the optimum. It is a screen copy from the figure publish by NikoWielopolski in his question (of course after rotation making horizontal the given straight line).
In order to obtain a rough approximate solution one can draw the function $f(x)=\sum_{i=1}^3 \frac{x-x_i}{\sqrt{(x-x_i)^2+(y_i)^2}}$ .
The zero of the function is graphically evaluated. $$x\simeq 6.4$$
They are a lot of numerical methods and softwares to solve more accurately the equation.
For example one can find a result as accurate as wanted thanks to the Newton-Raphson method : http://mathworld.wolfram.com/NewtonsMethod.html $$x_m\simeq 6.4017$$
Result drawn in red on the above figure.