The commander normally does not move backwards or sideways Well, he can move sideways and forwards together. He can also move backwards or sideways when chasing enemies, but it's difficult to base any real plan on that kind of movement.
You place your troops in one spot, and tell them to Guard Commander. They will march to whatever the location of the commander is.
So troops at the top of the formation will march down to the bottom if that's where the commander is.
Troops at the front will move to the back, if that's where the commander is.
If you place the commander at the very back and Hold x 1-5, attack rear, then your Guard Commander units will chase from wherever they are to the commander and join him in his charge forwards.
If you place the commander at the very back and Hold x 1-5, Stay Behind Troops, then your Guard Commander units will chase from wherever they are to the commander and join him as he moves forward to behind your main army group.
Here's an example:
RR are squads on attack rear, GG is smaller infantry on Guard Commander, C is a few commanders on Hold x 5, Attack Closest; or Hold x 5, Stay Behind.
Code:
........RR................
..........................
..........................
.........GG.......II..AA..
.........GG.......II..AA..
..........................
..........................
C.......RR................
Enemy infantry II will chase your GG, allowing RR to attack enemy archers AA. The archers AA locks fire on GG, possibly even advancing without firing as GG moves out of range. GG turns around and engages II at the same time RR reaches the Archers.
And this is not even theoretical, I really have used this in MP games, and it worked. Some of the time

.
Admittedly, it's also early game tactics. As AdmiralZhao notes, pretty soon the right Battle magic is much more important.