Damage can be done to a unit or upgrade by direct attack, indirect attack, or contamination. Being damaged will reduce a unit or upgrade's capability, so that a factory at half strength produces only half its capacity. The damage done to a unit or upgrade willreduce as the target becomes more damaged. If a factory in perfect condition loses 1% from a single attack, then any identical attacks that follow will always produce less than 1% damage. Eventually it requires a lot of work to further damage a structure, simulating real-world conditions.
Anything that suffers damage but is not destroyed will regain strength over time. Units in the field recover some strength, but they recover it much faster if they return to reserve. The AI will moves units to reserve if military initiative is at least 25% (Beta 7) and the unit is below a certain strength (strength?). Upgrades that are damaged will automatically repair themselves.
Offline facilities will repair at the rate of normal construction. Online repairs will take longer.
Be aware that repairing something will use the same resources needed to originally build it.