How much of it was military? How much of it was economic? How much of it was political? How long would it have lasted had Japan not brought the Allies and the US into the war against them? I've heard it argued that Japan was able to advance at will in China and that their occupation of China had no impact on their operations elsewhere. But I also know about significant Chinese victories like Changsha and Guangxi in 1939. What's the real story here?
From the Chinese side, it was a stalemate because they couldn't evict the Japanese army from China. At the very start of the major fighting, the Battle for Shanghai showed that Chinese armies would be chewed up and spat out if they faced the Japanese on even numbers and supply. In the 3 months of that battle, the Nationalists lost over half the strength of their "reformed divisions", the elite German-trained divisions that were the core of their military reforms. None of the members of the Chinese coalition (the Nationalists, the Communists, and various warlords) could sustain losses at the rate that high-intensity warfare would have entailed. After losing at Shanghai, they had little choice: fight at lower intensity.
It was politically important for the various Chinese factions to continue to fight the Japanese - essential if they wanted to be able to claim to be the legitimate rulers of all of China. However, their ability to recruit, train, and equip new forces restricted the level of offensive operations they could undertake. Their military and economic limitations forced the stalemate onto them.
From the Japanese side, it was a stalemate because they couldn't both control a hostile China and continue to advance into enemy territory. While Japanese losses were lower than the Chinese losses (Japanese military losses averaged about half of the Chinese losses over the war), they couldn't sustain high-intensity operations and maintain control of the territory they had conquered. Japanese limitations in this regard can be seen in the outcome of Operation Ichi-Go, the largest offensive ever mounted by the Japanese army, aimed at (a) linking northern China and Manchuria to southern China and SE Asia overland, (b) capturing the airbases from which US forces were bombing Japan, and (c) knocking the Nationalists out of the war. This offensive hurt the Nationalists tremendously, but failed to knock them out of the war. The concentration of forces for this offensive (about half of the total Japanese strength in China) also reduced their ability to control the territory they occupied, and the Communists made huge gains as a result. This was a maximum-effort offensive by the Japanese, and it failed to achieve what was perhaps the major strategic goal. This was THE Japanese effort to break the stalemate, and while it shifted the equilibrium of the stalemate, it didn't break it.
What would have happened without Japanese expansion of the war against the UK, US, etc.? It's a difficult "what if". Before the German invasion of the Soviet Union, there was a significant chance of Soviet intervention to stop Japanese victory. After that, the Soviet Union was rather distracted. On the other hand, the Japanese expansion of the war was driven by their perceived inability to continue to war in China. Take SE Asia to (a) further isolate China and (b) obtain raw materials (especially oil) needed to continue fighting in China. "We can't win in China, so let's expand the war" might seem foolish, but withdrawing from China wasn't politically acceptable for any Japanese government, and continuing in China without change looked like a bottomless quagmire. So, a gamble to take advantage of the Soviet Union being at least temporarily out of the picture - a gamble which they lost. Without any of that, it would be a question of just how sustainable the Japanese effort was. The Japanese felt that it was unsustainable enough to be worth the risk of taking over French Indochina, which suggests that victory over China was far from imminent.
their occupation of China had no impact on their operations elsewhere.
The lowest reasonable estimates of Japanese military deaths in China are about 500,000. These are the most widely accepted official Japanese figures, and Chinese estimates are much higher (double to triple this). This is about 1/3 to 1/5 of Japanese military deaths throughout the war, and, given the large fraction of military deaths due to disease and starvation (by far the majority of Japanese military deaths in New Guinea and the the Philippines; some estimates are that the majority of Japanese military deaths during the war were from disease and starvation), the fighting in China was the single biggest cause of Japanese combat deaths during the war.
The Japanese committed over 1,000,000 soldiers to China, at their peak military commitment. This is only the number for China proper, and excludes forces in Manchuria, SE Asia, and Burma-India. At minimum, this commitment, the expense of this commitment, and the resulting casualties were an enormous drain on the Japanese military and budget. Add into this that much of the other fighting was, in principle, aimed at supporting the war in China, and you have huge impact.
For some recent discussion of Operation Ichi-Go by u/hellcatfighter see https://old.reddit.com/r/AskHistorians/comments/ca2wdr/what_exactly_was_operation_ichigo_and_how/