One of the basic concepts of economics is that the production of goods and services are a product of both capital (equipment) and labor (the work to turn raw material into finished goods or to provide the services). Some industries are what economists call “capital intensive” — meaning that relatively speaking it takes a lot of capital to purchase the equipment needed to operate (think the automobile industry). A capital intensive industry is difficult for new competitors to enter. Other industries are labor intensive — meaning that it takes little to capital to purchase the basic equipment and labor is the main input (think almost any profession). The only restrictions on entering these industries is any licensing requirement for workers. The degree to which an industry is capital intense (and how much skill the labor requires) in turn has an impact on the degree to which it is vulnerable to foreign trade and immigration poses a threat to existing workers.
None of these basic concepts are new. In the middle ages, trade and exploration were capital intense industries. It took a significant investment to purchase the initial goods to trade and the ships. With the exception of a handful of positions (e.g. pilot, navigator), most of the positions on the ship could be easily taught to new employees (and on certain ships, like galleys, slave labor was not uncommon). The need for a large pool of investors with limited risk (not wanting a disaster at sea to bankrupt all of the investors) led to the formation of the corporation. Other jobs (silversmith, woodwork) required little in terms of equipment and depended mostly on the skills of the workers. Over time, the workers in these industries formed guilds to regulate entry into the profession (insuring high skills and maximizing the income of those with established businesses).
The industrial revolution changed the balance between capital and labor. Businesses that used to be labor intense became capital intense as mass production allowed the factory to make many more goods over a shorter period of time with fewer workers than artisans could working on their own with a small number of apprentices. The corporate form gave capital an advantage in negotiating with labor. Even with training expenses, it is easier for a business in a capital intense industry to replace a worker than it is for the worker to find another job in that industry (with only a small number of firms in each industry). This disparity in power led to the union movement. By forcing the business to negotiate with all of its workers at once, the union put workers on a roughly equal playing field with management. Admittedly, in some industries, unionization makes little sense (or at least after a certain level). A top-notch doctor is likely to be able to negotiate one-on-one with multiple hospitals (or start up their own practice). On the other hand, the custodians at those same hospitals are unlikely to be able to negotiate an individual premium for being the best custodian, and probably needs a union to maximize the wages for all of the custodians.
This basic background leads into trade politics. During the middle of the twentieth century, the United States had a clear edge in the technology and finances required for most industries. This advantage led to the United States adopting policies that were relatively pro-free trade. Letting products from industries in which the United States was not heavily involved with relatively few import duties helped consumers, and the good that were produced in the U.S. were vastly better than their foreign competition (and as such, even with low import duties, foreign produced products did not occupy a large percentage of the market). In such an environment, with few U.S. barriers to trade, it mostly made sense (and, to some degree, still does) to negotiate deals in which the U.S. and other nations agreed to reductions in trade barriers.
Over the past sixty years, however, the rest of the world has closed the gap with the U.S. The expense of shipping goods results in most major corporations opting to build factories close to their customers when economically feasible. What dictates economic feasibility involves a variety of factors such as size of product (smaller means lower per unit transportation costs), labor skills involved (higher skills require a better educated worker), and equipment requirements (more equipment per factory tends to result in fewer factories around the world). Unlike the old days in which almost every industry in the U.S. benefitted from trade, now there are winners and losers from trade deals. The fact that the U.S. begins with a more pro-free trade policy than most of the rest of the world reduces the U.S. leverage in negotiations. Simply put, the rest of the world will not agree to implement labor-friendly politics that their economies are unable to sustain merely to get more access to the mostly accessible U.S. market. In short, significantly reducing trade barriers in other countries while slightly reducing U.S. trade barriers tends to be a net positive for the U.S. as a whole. However, there are certain industries that are vulnerable to expanded trade. Over the years, the U.S. has not done well in figuring out ways to transition workers in these industries (mostly, but not entirely, involving lower-skilled labor) to comparable or better jobs. As with lots of quiet benefits (e.g. good infrastructure), those who benefit from free trade do not necessarily realize how free trade improves their lives, but those who lose their job when their employer moves overseas are quite aware of the downside of free trade.
Immigration has similar problems. The immigration debate has two components — unauthorized and authorized. While there are exceptions (skilled workers who do not leave when tourist and student visas expire), a substantial number of unauthorized immigrants come here with few skills and float into industries that require few skills. Most of these industries do not pay workers well (putting aside any violations of the fair labor standards act with unauthorized immigrants). Whether these industries would pay more attractive wages if there were no unauthorized immigrants is debatable, but there is not a large number of legal workers willing to do this work at the wages currently being paid. However, myths about the effects of these immigrants on the economy make it easy for native-born citizens who are having trouble finding decent paying jobs to place the blame on illegal immigration.
The authorized immigration debate is harder because it tends to occur at the higher ends of the income brackets. Theoretically, a H1B work visa is only granted upon a showing that the would-be immigrant has skills needed by a business that can’t be found among U.S. citizens. This type of visa goes to groups like athletes, entertainers, models, etc. The employer is supposed to pay prevailing wage to those with H1B visas (a rule apparently frequently broken by Donald Trump and his companies) to prevent the employer from using H1B visas to lower wage costs. The big controversy with these visas tends to be in the sciences and high tech industries. We allow a good number of foreign students into our universities, particularly in the sciences. At the end of the day, our schools graduate a significant number of native and foreign PHDs in the sciences. A low number of H1B visas makes it easier for Americans with PHDs in the sciences to get jobs. On the other hand, it sends a large number of foreign-born PHDs back to their home countries where they can make their home country more competitive with the U.S. In short, a nice catch-22 of long-term benefits (keeping the best and brightest scientists in the U.S.) versus short-term benefits (keeping the wages of highly skilled American-born workers up).
The trade and immigration debates are not easy. They require a complex examination of the details of proposals. Unfortunately, politics are not well made for complex debates. Most voters do not have the time and patience to work through those details. This makes it easy for a politician to claim that a specific proposal is bad and that they will negotiate the greatest deals ever. Additionally, most of the benefits of trade and immigration are not easy to perceive while the costs are readily apparent to those who are hurt by trade or immigration — putting aside those who hate all things foreign and want a fortress America composed primarily of white Anglo-Saxon Protestants (a country that we never had and that is not coming back).