Before gains from trade can be realized, potential trading partners must agree on terms of trade. Economics can't tell us what terms of trade will be agreed upon in any particular case. Agreed upon terms depend on a variety of factors including: bargaining skills, attitudes toward risk, relative importance of the products being traded, past trading experiences, and many other factors too varied and complex to delve into here.
We can use simple economic reasoning to understand the worst possible terms of trade that would ever be agreed to, as well as the best possible terms of trade one could ever hope for. Not surprisingly, the worst terms for one trading partner lead to the best terms for the other.