edit: forgot to ask as well, how can you tell if a unit is veteran, and do they automatically become veteran when a barracks is built?
Right click on the unit in question. That will tell you if it is conscript, regular, veteran or elite. Or look at the vertical bar next to the unit. Green is a healthy unit, yellow wounded and red is almost dead. Now count the number of segments. A conscript unit will have two segments, regular three, veteran four and elite five. War Elephants will have an extra segment, so a veteran War Elephant will have five (not four) segments.
Each segment indicates how many rounds of combat that unit can lose before it is destroyed. Units can lose health (have empty segments) from combat. Many things influence combat and I won't get into that here. And while not absolutely always true, a veteran Spear/Archer/Horseman/Sword/etc. will generally/ususally/most-of-the-time do better in combat than a regular Spear/Archer/Horseman/Sword/etc.
If a unit is in friendly or neutral territory and does nothing for an entire turn, it can health one segment per turn. Thus, a red-lined, nearly dead vSpear, if left alone for three turns after it is wounded, will be at full health again.
If a unit spends its entire turn in a city with a barracks, all damage will be healed in one turn.
Any units produced in a city with a barracks will be veteran status. Harbors confir veteran status to ships and heal damaged ships in one turn. Airfields work the same for aircraft.
Units can also promote from conscript to regular, regular to veteran, veteran to elite and elite to *elite, which creates a Militray Great Leader (MGL). MGLs are nifty in many ways. The odds of promoting from each rank to the next higher are 1 out of 18 for most civs, but 1 out of 12 (I think) for the Military civs, like Rome, Scandanavia, China, Zulu, Japan, Germany or Aztec, plus some others.
Thus, having a barracks gives you stronger units (4 hit points vs 3 hit points) and even stronger units later as they promote to elite. An elite unit that has produced an MGL cannot produce another one MGL until it is upgraded. Elites units, when upgraded, are retrained at veteran status. They can now promote to elite and then they are able to spawn a second MGL. This is rare but it can happen.
The game will name an elite unit that generates an MGL by adding an asterik in front of the unit name. Spear would become *Spear, for instance.
MGLs are sorta super-units. MGLs are rush any normal city improvement or Small Wonder. They cannot rush a Great Wonder (like the Pyramids). They can also form Armies, which are powerful, multi-unit units. An Army can hold 3 military units. They will fight as one unit. An Army moves faster than the units inside. A three Sword Army will have a movement of 2, not 1. Generally, Armies are composed of unit type, whether Swords, Knights or Cavalry. The game will let you combine types but don't. Just don't.
The strength of an Army is measured by the total hit points of the units in the Army. Three vSwords in an Army give it a strength/endurance of 12. The advantage of the Army is that when it attacks, it is as if the 3 Swords attacked in succession. And until all 3 Swords are dead, the Army lives and can heal itself. If a Pike, which defends at 3, were the top defender of a city or unit stack, one Sword attacking by itself may or may not kill, since Swords attack with 3. An Army attacking that Pike will attack until all 12 hit points are gone. Most Pikes will not be able to withstand such an attack.
Armies can also attack multiple times per turn, up to the number of their movement points.
Healthly Armies will not be attacked by the AI until the AI gets Bombers.
So, Armies are good for a lot of things, but can only be gotten by turning an MGL into an Army, which can only happen in a city with a barracks. MGLs are birthed by elite units, which are promoted up from veteran units. A regular unit can promote up to become a veteran, but it is cheaper, easier and deadlier to simply have veteran units built in cities with barracks.