an ordered rank or row of things set in place, above all an army drawn up in battle line
This word comes from a verb meaning "to arrange, to set in order, to lay something out in rows." At its heart it names things put into ordered position, and by far its most common use is military: an army drawn up in ranks, facing the enemy across the field. It is the battle line itself, the fighting men set in formation for war.
The word clusters heavily in the story of David and Goliath (1 Samuel 17), where "the ranks of Israel" stand opposite "the ranks of the Philistines," and the giant taunts "the ranks of the living God." The same picture drives the earlier defeat at Aphek (1 Samuel 4) and the muster of David's warriors who "could keep rank" (1 Chronicles 12:38).
The same word can name an ordered arrangement that has nothing to do with war. It labels the row of lamps set in place on the lampstand (Exodus 39:37), and, in a difficult verse, the orderly arrangement built for Gideon's altar (Judges 6:26). A closely related word from the same root, מַעֲרֶכֶת, names the ordered rows of the bread set out before God, while the general word for a body of troops is צָבָא.