Repairs are conducted automatically upon damaged ships which end their strategic turn in the same sector with components or facilities with repair ability. The priority/order in which repairs are carried out is determined in your empire settings, by type of component.