Riders form a paceline because of the crosswind which forces everyone to look for draft on the left or the right side of a rider in front of you. Eventually, there's not enough road for everyone to be in the draft and the first paceline is formed (also called an echelon).
More specifically though, paceline refers to the mechanics of the echelon, the way riders rotate, or take turns at the front to stay in the echelon. This rotation is the paceline.
Pacelines for group rides and the like can be formed whenever, and they do not form just because of a crosswind. When I used to train with a group, we would almost always form pacelines in single file, on every ride.
1630s, "a small body of soldiers acting together but separate from the main body of troops," from French peloton "platoon, group of people," literally "little ball" (15c.), hence, "agglomeration," diminutive of Old French pelote "ball" (see pellet).