In my dojo and the main dojo, most folks know each others ranks and there's some attempt to line up that way, but it's not at all a big deal. When I travel, I always line up on the low end of the mat when visiting a new dojo. I just think that's the most polite thing to do. I also always carry a white belt in case its a different federation, style, etc.
My favorite thing to watch is the jostling for position that occurs at big seminars. In this case, the high mucky-mucks tend to wedge themselves into the the middle of the front line to be visible to the sensei to take ukemi. Sometimes folks will wait until things are quite quiet then wander in and plop themselves down in the middle, expecting folks to part like the Red Sea. It's an interesting vignette.