What makes DNA/Protein in a gel run in straight lines? In a gel electrophoresis, let's assume an SDS-PAGE, I understand that the sample is loaded on a cuboidal well and the electric field is straight downward. It is easy to assume that the sample is going to run straight in the gel. Like it does here. 



But when I observed the apparatus in my lab, the anode was all throughout the base - looking something like this (cathode not shown here and the anode is insulated on the side - so effectively present at the base of the gel).



What makes the sample run in the gel only in a straight line? You may say that the forces cancel out on the either sides but what about the well that's at one end? It's being pulled downwards and also the other end.

So how does this work?
What you are trying to achieve in the electrophoresis experiment is a homogenous electric field. If the electric field points downward homogenously, then the greatest force will be exercised in a downwards direction which will lead to a downwards movement of your charged sample.

While not being exactly equivalent, you can show a similar feature (homogenous field) with a horseshoe magnet. If you place a piece of paper or cardboard over the top of it and then sprinkle iron filings onto that, they should arrange themselves in a linear fashion between the magnet’s poles.