The initiative stat determines which troops attack first in battle. Troops that have a higher initiative always attack first. However, this bonus only takes effect once per round. A round is considered completed when all of the attacking troops have had chance to strike the defending troops and vice versa.
If the opposing troops have equal initiative, then the side that attacks first is determined randomly. Both you and your enemy have a 50% chance of striking first.
Note that engineer corps troops only have bonus initiative when fighting troops with the "Fortification" trait, while fortifications have a higher base initiative against all types of troops.