Maybe I have too much time on my hands but I decided to make a note of the formations in each wave to see if I could figure out a pattern. I also kept track of which squad(s) took the most damage, to test
@Gargon667's observation. (I did also try to keep track on the few occasions I used 5 of the same unit but it got too complicated). I realised the only time you see squads in numerical (position) order is when you select them initially. At the start of the 2nd and 3rd waves you only see them on the field and I only thought about them in relation to each other, the enemy troops and any obstacles. In numerical order it soon became blindingly obvious.
The formation is reversed for each wave. So, for example, a formation in positions 1-5 of M
LR M M LR (the one in bold having taken the most damage) becomes LR M M
LR M for wave 2, and is (I assume) reversed again for wave 3 so it reverts to the original formation. (There are of course fewer 3 wave battles so it's harder to test, but it certainly looked that way.)
The only time it appears unchanged from 1st to 2nd wave is with a symmetrical formation eg M LR LR LR M, and it's only the position of the damaged squads that gives it away (if you even notice). Oddly though, with the formation M LR M LR M it didn't reverse, so for instance if the squad in 4 had the most damage it stayed in 4, and so on. I think I had 3 of these set-ups and it was the same every time.
The pattern didn't change regardless of which troops were used or whether I had a 2+3 or 1+4 combination. However I didn't use more than 2 unit types in any one battle so couldn't test that set-up.