What exactly does edge loop selection do?
An Edge Loop is a chain of connected edges where each edges shares a vertex with the previous edge, and that vertex has exactly 4 edges attached to it (except on the borders of a non-manifold (not "water-tight") mesh, where there will be only 3 edges, 2 of which have just one face connected).

An edge loop is terminated where the vertex has more than 4 edges (poles) or meets a non-manifold edge (an edge with only one face) or an Ngon (face with more than 4 verts). The latitudinal loops (rings) of a UV sphere are perfect non-terminating loops, but the longitudinal loops (segments) all end at two points (the North and South poles)

Here are some examples of edge loops (see where they change direction or terminate and why)







Details on the algorithm from the wiki:


  
  First check to see if the selected element connects to only 3 other edges.
  If the edge in question has already been added to the list, the selection ends.
  Of the 3 edges that connect to the current edge, the ones that share a face with the current edge are eliminated and the remaining edge is added to the list and is made the current edge.