Answer:
The best way to understand how outsourcing production to foreign countries work is to analyse a real world example. We can use GE and refrigerators for our example (it is a mature product). I just purchased a new refrigerator and noticed that it isn't built in the US anymore, but instead it's built in Mexico. I should be getting the new refrigerator tomorrow, but I've seen the same model on display on a retail in the past. I believe that it is well built and obviously I liked it, therefore, I decided to purchase it (besides getting a great deal online).
What made GE relocate the production of refrigerators to Mexico? I guess that the answer is lower production costs that offset any distribution costs, and no import tariffs. I really couldn't see any difference between this new refrigerator and my old refrigerator, except that the old had manual controls while the new one has digital controls.
This means that the quality of foreign goods can be as good as American goods. Since my family has always loved Hondas (Accords and Civics), I believe that Japanese cars are better, but since they are built in the US they do not fit this analysis.
Equal quality + lower prices = higher profit margin
That is the reason why American firms move their production facilities to other countries.
Of course, not all countries will have the same advantages that Mexico has, most imports pay tariffs. There is also a huge difference between purchasing something from Mexico (where most factories belong to American companies or provide goods to them) than purchasing something from China or some other country in Southern Asia. I like Hondas, and I could buy a Honda car built in Japan, but I wouldn't buy a Chinese car. And no matter which brand that Chinese car has, I will still think it's low quality and useless.
The decision depends on many factors, but ultimately, financial advantages (or disadvantages) will determine the outcome.