You may think that the person who designed your brake lines was crazy, but all of those bends and loops have a purpose: They add flexibility.
Cars and trucks bend and flex as you drive. Many trucks have a frame that supports the body. The body is attached to the frame by rubber mounts, so there can be a lot of motion between the body and the frame. The master cylinder is attached to the body while some of the other brake components are attached to the frame. Also, when you step on the brake pedal, you flex the firewall of your car, moving the master cylinder but not the other components in the brakes.
A car is not always built with perfect accuracy. On one car the distance from the master cylinder to the anti-lock brake system pump will be slightly different from that on another. The extra flexibility added to the brake lines allows cars to be assembled even though they are slightly different from one another.
If the lines were short and straight, the motion of the car would eventually crack the brake lines; the continual flexing would fatigue the metal and eventually break it, just the way a spoon bent back and forth repeatedly will eventually break. By forming the brake line into a coil, the flexing in any one section is very small, and so puts almost no strain on the line.
To learn more about how different types of braking systems work, check out the links below.
Related HowStuffWorks Articles