The battle is started by clicking on an enemy unit that's reachable by one of your own.
When you select a unit, if there are any in a reach of it's attack, the square will be colored with transparent red. This means you can attack that unit.
After you select a unit that you want to attack, a battle screen will appear.
When a unit A attacks unit B, unit A will deal damage first. Based on several parameters the damage dealt is calculated and applied to the defending unit.
Hit points of the unit B are subtracted by that amount.
When the unit A finishes the attack, the unit B counterattacks, but with hit points it has left, which is probably lower than what it started with.
Be aware of the fact that while in training missions unit A is always yours, in the real world it might not be, so make sure your unit is well covered when you anticipate a defending battle.
Cover is provided by different surroundings, like ruins or forests. And some surroundings, like swamps, even provide negative cover, so the unit staying there will get hit harder.