It's simple self interest. If you perceive trade as benefiting your interests (which, by definition, would imply not giving your opponent a meaningful edge in the conflict) then you trade.
It's the same thing that decides when wars end. Either side is free to surrender or withdraw at any point in a war. They continue fighting when they think that the result they can obtain (win or lose) in the future will be better than the result they can obtain in the present. They stop fighting when that no longer becomes the case, at least assuming non-insane leadership.
War isn't the end of relations. It's not infrequent that enemies today are allies tomorrow, or vice versa. Nobody ever knows what tomorrow holds, and history seems to love a nice plot twist.
replies(2):