Are we talking about minutes, hours, days (in some cases)? I once read that battles during the crusades sometimes went on for hours and some even days - is that accurate?
I always wondered whether battles really played out like in the movies in which the front row of the armies just suicidal/ fanatical ran into the other side hacking everything in sight or if it looked more like police/ violent demonstrators who kind of just pop up on the first line beat or throw something and then retreat back into the line?
Obviously the latter tactics would take much longer than the former.
It varied drastically. In the classical period, some battles could end immediately if one side lost their nerve just before a clash of arms (eg. the Romans at the Allia, the Argives at Coronea). They could also last several hours or most of a day (Sabin 4-5; many Roman sources are clear on this). They could even last multiple days (Alesia was four days, Yarmouk was six!). In battles lasting multiple days, the fighting seemed to occur for around 4-8 hours on any particular day, but as occured at Alesia, major fighting may also occur at night.
Caesar is the perfect source for this matter. He gives us a lot of detailed information in the Bellum Gallicum on the duration of some battles he commanded, and as he wrote shortly after the events occured we can trust his memory to be broadly accurate (see Kagan 111). The epic Battle of Bibracte in 58 BC lasted "from the seventh hour (around 1 pm) until evening (after nightfall)" (BG 1.26). Interestingly, when you asked how long it took until the "losing side began to flee", Caesar notes of the Helvetii at Bibracte that during the entire course of the battle "no-one could see an enemy soldier turned in flight." Bibracte is an example then of a battle not only last many hours, but wherein at no point did the enemy morale break- rather they were physically forced back due to casualties and fatigue. The huge casualties that this slogging match entailed forced Caesar to rest and consolidate for several days before he could conduct any pursuit (1.26).
As for the mechanics of these battles that allowed them to go on so long, this question quite understandably gets asked a lot. You can find detailed answers to that matter from myself here and from /u/Iphikrates here. Basically, while some rare battles may have involved both lines physically crashing into each other, infantry combat was in general a more tentative affair where formations would be broadly maintained and one or several ranks closest to the enemy would do all the work while the rest provided moral support and replaced casualties. Battles followed no formula however: as I said, some might end before contact, some ended quickly, some went for hours, and some went for hours a day for several days. The reasons for this are obviously down to the context and the various tactical and psychological factors that decided any particular battle. But it is interesting to note that, as in the case of Bibracte, a battle did not even necessarily end with one side routing. On rare occasions, soldiers/warriors as formidable as the Helvetii at Bibracte (or the Nervii at the Sabis) really did force their opponents to basically kill them all to win. Despite what a Keegan or Goldsworthy might imply, on rare occasions, large formations of warriors/soldiers really did value honour and courage over life. Aside from the fact battle didn't look like it does in the movies, this helps to explain how ancient fighters could psychologically bear pitched battle for such long periods.
Sources:
Caesar, Bellum Gallicum.
Kagan, The Eye of Command, 2006.
Sabin, The Face of Roman Battle, 2000.
The Cambridge History of Greek and Roman Warfare chapters (Volume I or II) on "Land battle" would also be informative reads if you could get a hold of them.
While I don't agree with him in some areas I think Goldsworthy, The Roman Army at War: 100 BC-AD 200, is a great read on this and many other matters to do with Roman-era warfare.