"ranger" comes from "rang" (row, rank) and has two main meanings.
The first one is "to arrange", "to put away", "to tidy up".
ex: Il faut ranger les livres par ordre alphabétique. ("Books have to be arranged alphabetically.")
ex: Range ta chambre ! ("Tidy up your room!")
The second one is more litteral, "to line up". The verb is then used in the reflexive form, "se ranger".
ex: Les soldats se rangent à l'appel du commandant. ("Soldiers line up at the commandant's call.")