Forming a good formation against your opponent army composition is the key for a successfull engagement. The formation frontline is composed of a maximum of 8 slots and the maximum amount of slots that can be used is 24.
Clicking on the army brings the current army formation where usually units of the same type will be grouped together which is not always the best option. Moving the different groups of units around is done by clicking on the left and right arrows that are located under the unit icon.
Splitting and merging is done by typing the amount you want to split or merge in the input box below the unit icon and clicking the arrow (to merge/split left or right). If the units on the side are the same type of units that are being moved, they will merge, else the original group will split.
There is a distinction between melee and ranged units where ranged units are always kept in the back of the army formation. Once all the changes are made the link "Change formation" must be clicked to save the changes.
Having the right formation against an opponents army means (for example) placing your Spearmen or Pikemen units in the same slot where the enemy cavalry is placed. Having a wider frontline than the enemy means that the group of units that is without an enemy group in front of them will have a free attack (without retaliation) to the closest enemy group (read more about combat mechanics).
To scout the enemy army (and uncover their formation) you must click on it and click the "Scout" link. However you can scout the enemy army only if your army is near it.