Engineers like Royale Lee, 31, are one reason Taiwan is the world’s biggest contract producer of the microchips that power almost all electronics.

When a computer virus paralyzed machinery at his employer, Taiwan Semiconductor Manufacturing Co., Lee pulled a 48-hour shift to help fix the problem. For years he responded to phone calls day and night. But in late 2021, after five years of sacrifices, he had come to fear the ring of his phone. His annual compensation of $105,000, an envied sum in Taiwan, was not enough for him to stick around.

Over the past decade, TSMC, as the company is known, has built a wide lead over rivals like Intel and Samsung in the race to make the smallest — and fastest — microchips. Largely because of the ingenuity of its engineers, TSMC has become one of the most geopolitically important firms in the world.