What is the best approach to find the nearest line segment (x1,y1), (x2,y2) from a point (x,y)? Let's suppose the are three line segments in a plane, each line segment has coordinates (x1, y1) and (x2, y2). What is the best approach to find out the nearest line segment from a point (x, y)?
Hint: use vectors dot product.

The distance from a point to a line is given by the projection of a line from the point to some point on the line onto a unit vector orthogonal to the line.
First we need same data.
lines = Partition[RandomReal[{-1, 1}, {6, 2}], 2]
point = RandomReal[{-1, 1}, 2]
Graphics[{Line[lines], PointSize[0.02], Red, Point[point]}, 
 Axes -> True]


Then we need unit vectors orthogonal to our lines:
ortho = Normalize /@ (Subtract @@@ lines).{{0, 1}, {-1, 0}};

The distance from the point to the lines is now given by the absolute value of the projection of the line from point to the start of the lines onto the orthogonal unit vector:
dist = MapThread[(Abs[(point - #1).#2]) &, {lines[[All, 1]], ortho}]
(*{0.0292868, 0.260295, 0.347937}*)

It is obvious, for our example, that the first line is closest to the point.
