Greg's Airplanes and Automobiles on Youtube has a recent video on the P40.
I don't know how to make the movie work here but a link is below.
General things I've read here involve how it's use started before Dec 1941 when the USA was not putting a lot of money into research. The British used it in North Africa in 1941 and they were trying to use it with dogfighting tactics that it was not totally successful at. Then it was Lend Leased to Russia and their airforce had been hit hard by Germany so pilot skill and tactics could have suffered there also.
Greg's video linked above impressed me with how all the added boost and power only increased top speed 20-25mph. That was in part because it still ran out of power before it was able to benefit from reduced drag up high due to the single stage supercharger situation.
I generally like that guy's videos but he went off the rails in this one IMO. The Merlin-engined P-40 was considered by the USAAF to be the only one which could contend with Bf 109 or MC 202 / 205. The top speed doesn't tell the story, the real issue was altitude. As others mentioned, Allison P-40s began to really lose steam somewhere between 12,000 - 16,000 ft (depending on the specific type). The ones that still had power at 16,000 ft sacrificed a lot of the beast like power that say, a P-40K had 5,000 ft lower.
The P-40F/L (merlin engine) had decent power at 20,000 ft and was in the game at 23-24,000. They could make 370 mph at 20,000 ft. That meant they could tangle with 109s an C.202 when used as top cover. This meant for example they could still turn into attacks guns blazing, which was the standard tactic when facing high flying 109s. And thanks to the two speeds, they still performed pretty well down low. All of the USAAF fighter squadrons in North Africa used P-40F/L, with the brief exception of some P-40Ks by one squadron of the 57th FG, just due to shortages. The British only equipped 2 squadrons with the F/L ("Kittyhawk II and IIA") and found when they tried to switch back to the Allison types, casualties increased dramatically.
The merlin engined P-40 was definitely needed in the North African campaign and in fact it was probably the single most important fighter type from early 1942 through the end in Tunisia in June 1943. One of the major Axis bases, at Pantelleria just off shore of Tunisia, was actually 'captured' by the 325th FG. After that, into the Sicily campaign some of the better mark Spitfires and improved P-38s were arriving in some numbers. But the merlin P-40s were still being used as fighters through the Battle of Anzio (June 44).
In the Pacific, they did also use some of the Merlin P-40s, but the Allison types were good enough and able to hold their own pretty well. In China for whatever reason, they seemed to dominate.
The P-40 was a deeply flawed aircraft with some excellent features. It was a well designed airframe and fairly aerodynamic (though nothing like the low-drag P-51). The Allison P-51 by the way did not do so well in air combat and did not compare at all to the P-40 on a mission for mission basis in China or in Italy, except (in the A-36 version) as a bomber. The P-40 was deemed too flawed to continue to use but extended teething issues with and / or relatively slow production / development of other US types meant that it remained in use far longer than planned, and it turned out to have features which made the aircraft able to survive combat and destroy enemy aircraft much better than it should have done. Which is why it remained in use, not just because there were no other options (there were).
The flaws were the altitude limitations and rate of climb, especially when fully loaded.
The advantages were:
Very good turn rate (on the Allied side, second only to the Hurricane and Spitfire, and various biplanes)
Excellent roll rate (second only to the P-51 and Fw 190, IIRC)
Good dive acceleration and high dive speed (fast enough in a dive to evade Zeros and Ki-43s, just barely enough to often if not always evade Bf 109s)
Trim tabs so it could still be controlled, albeit with some difficulty, at very high speed (making it easier to evade A6M and Bf 109 in dives in particular)
Moderately good range (better than Bf 109, MC 202, Spitfire and Hurricane, but not comparable to A6M, P-51, P-38 or F4U) meaning it could climb to altitude before combat and reach farther for strikes
Heavily armed
Strongly built (to withstand 10G) and pretty well armored
Relatively reliable and easy to maintain (still temperamental as all warplanes were, but far less so than many other competing types, meaning it was available and in larger numbers than many other fighters in a given Theater.
Pretty effective at bombing and carrying a substantial bomb load - more than a lot of light and medium bombers.
All of that meant that pilots often survived engagements, and when they had a chance to attack enemy aircraft, they often destroyed them. This is why most pilots that flew them really liked them, whereas commanders and administrative people did not. It was not a plane of the early war but of the middle, and it played a very important role for US in Pacific, China / Burma / India, and North Africa, and a very important role for the British in North Africa, and for the Russians, all especially during late 1941 through early 1944. Really, the turning point of the war.