As Wikipedia and other sources make clear, most twins with counter-rotating props are configured with the left (#1) prop turning clockwise (as viewed from behind the plane) and the right (#2) prop turning counterclockwise. But there are significant exceptions, such as the P-38. What the sources do not make clear is the reason for the exceptions. There are a few vague comments about the P-38 having "unsatisfactory" handling as originally configured with the common setup, but nothing that helps me understand what aerodynamic or other issues might make a P-38 or any other plane a candidate for reversing the rotation directions. I realize that there are potential issues with coupling to tip vortices if the engines are near enough to the wingtips. And I assume that there might be effects related to air impinging on the fuselage, or FOD from stuff entrained in the airflow during ground ops, or maybe issues with where ice being slung from the prop blades impacts other structure. But I am wondering if there is a more general aerodynamic principle which drives the rotation direction decision.
Most twin-engine aircraft with counter-rotating propellers have the rotation set up so that the propellers are rotating inward towards the center at the tops of the propeller arc.
This configuration reduces the P-Factor effect at slow speed high angles of attack, and eliminates the "critical" engine that is present on multi-engine aircraft where both engines rotate in the same direction.
There were some tail buffeting problems identified with the XP-38. While trying to solve the tail buffeting problems, various wind tunnel tests were conducted. Some of these tests were done with "outward" rotating propellers.
These tests showed that "outward" rotating propellers did not reduce tail buffeting BUT they did reduce power on/power off pitching moments, and therefore made for a more stable gun platform.
"The P-38 props rotate in the direction they do for the simple reason it reduced the power on/off pitching moment, thus making for a more stable gun platform" - Kelly Johnson, P-38 designer.
The tail buffeting was eventually solved by fitting large leading edge fillets at the wing/fuselage interface.
The YP-38 (Y=Prototype) and most subsequent versions of the P-38 retained the "outward" counter rotating propellers. This in effect made both engines "critical", but combat performance was more important that low speed performance.
There are two considerations.
Two parallel vortices will tend to move upwards if the air flow between them is upwards. You can think of it as each 'blowing' the other upwards.
This suggests the P-38 configuration maximises lift. I am not convinced but I don't have access to the software to know either way. Nor did they.
The second consideration concerns one of the reasons for having two engines - the ability to fly on one.
This suggests the almost universal decision to let the dead weight engine help provide the torque needed to turn the working propeller rather than adding to the lift the unpowered wing has to provide.