You see in almost all movies, TV shows, and even video games where formations of soldiers, large and small, would be marching in cadence while moving on and off the battlefield. Was this actually done, or would large formations/phalanxes etc simply keep their form without cadence, seeing as much of the time they would be marching over uneven ground, and not all had drummers?
The simple answer to your question is yes.
However, the more complicated question is: some did, some didn't, and some would be somewhere in between. Keeping and maintaining formation in battle is a hybrid between tactics and technology, so it simply wasn't practiced or wasn't discovered by all groups who would have been putting together armed bands.
Depending on what time period you're talking and what group you're talking about, you're dealing with a broad range of possibilities. In some cases you'd be dealing with professional soldiers in other cases you'd be dealing with conscripted soldiers or obligatory service from just regular folks.
With formations and uneven ground, and even with drums, the formation usually doesn't advance forward in a straight or perfect line. Depending on the circumstances, the unit would stop to reform, change formation, or change their facing. Aside from just the landscape changing the direction, units will also bunch as soldiers would attempt to find cover behind their colleagues. Especially when shields were involved. Phalanxes and Hoplites would gradually move to the right as folks generally attempted to keep behind the shield of the person to their right, which in theory was there to protect them too.
It's sort of a time and place issue. However, the Romans wrote about their military history quite a bit, including some specific works that were exclusively about the military.
A couple of specific texts that come to mind: http://en.wikipedia.org/wiki/De_Re_Militari http://en.wikipedia.org/wiki/Stratagems_%28Frontinus%29
Drummers, as far as I am aware, only became common in armies after musketeers came to dominate the battle and it was necessary for marching bands to be heard over the firing. Drums were known in antiquity, but appear not to have been employed by armies--there are no known artistic depictions or literary references to drums in a military context in Latin, or in Greek. Armies in antiquity included a number of instruments, some (mostly various kinds of horns and trumpets) used for giving orders and signals, and others used to mark step. The use of aulos-players to mark step in Greek armies is well attested, both in visual evidence (see the Chigi vase) and in literature (what immediately comes to mind is Thucydides' mention of the Lacedaemonian custom to employ professional aulos-players at all times). This practice was also used on Greek ships to keep the rowers together. But the Romans are a somewhat trickier story. We know the Romans had several different kinds of horns, all of which signified different things, but we don't know how they kept step. That they did keep step and were trained to is obvious--Vegetius mentions two military marches, the "militaris gradus" (twenty Roman miles in five summer-hours--Roman hours changed length depending on season, since they just divided the daylight hours into twelve equal portions) and the faster "plenus gradus" (tweny-four miles/five summer-hours). We don't know if any particular instrument was used to keep this time, or whether it was kept with some sort of chant (or if a Roman recruit had it so thoroughly bashed into him that it ticked away in his head while he was asleep). I find the idea of chants somewhat convincing, since horns are somewhat poorly suited to marking time, and we have no indications of other instruments being used by the legions. But we don't really know, other than knowing that it was kept somehow
One thing about marching seen in TV shows: I often notice that the actors arent really marching in cadence, it's just the sound played with it that creates this illusion. I guess it is pretty hard to get a bunch of not trained people to march properly.