5 wings is the "optimal" number for most missions (stacking is normally -10% effectiveness per wing, except for some ground attack missions which are -10% per wing over the first, allowing one more wing for the same penalty). One wing is the most "efficient", but will easily be defeated or even destroyed in combat. Total firepower is reduced by stacking as follows:
1 wing = 1 attack strength x 90% effectiveness (100% - 10% stacking penalty) = 0.9 effective firepower
2 wings = 2 attack strength x 80% effectiveness = 1.6 firepower
3 wings = 3 attack strength x 70% effectiveness = 2.1 firepower
4 wings = 4 attack strength x 60% effectiveness = 2.4 firepower
5 wings = 5 attack strength x 50% effectiveness = 2.5 firepower = highest firepower for the entire group
6 wings = 6 attack strength x 40% effectiveness = 2.4 firepower
.....and it goes downhill from there, until you hit:
10 wings = 10 attack strength x 10% effectiveness (penalty capped at 90%) = 1 firepower
25 wings = 25 attack strength x 10% effectiveness = 2.5 firepower
> 25 wings @ 10% effectiveness per wing = > 2.5 firepower
.....so unless you run more than 25 wings, 5 is the optimal figure.
The odd exception is CAG Duty, which only has half the stacking penalty (-5%), so 10 wings would be the maximum firepower figure, but 8-12 would all be relatively similar in firepower, within a few percent.
In air-to-air combat, it's often better to have 6 wings than 5, because even though the offensive firepower is marginally lower, the increased number of planes will allow them to distribute damage and take less hits per plane, allowing for faster repairs if you have enough airfield or carrier capacity to handle all of them. That means the optimal numbers are 8-12 CAG wings on CAG Duty, and 4-6 for other missions. At 2 wings per carrier, that's 4-6 CVs per fleet for defensive operations, and sending no more than half of the wings for other missions.
There was a noteworthy incident in my game last night involving CAGs: I had one CAG based on a CVL attached to a Surface Action Group, and the fleet got into combat against a couple of opposing BBs, with land-based air assisting the enemy fleet. My CAG lost all of its ORG, but continued to fly again and again the next hour as it regained a shred of ORG. With the enemy planes in the sea zone, I couldn't rebase my CAG to land because it was immediately engaged, defeated, and returned to its carrier instead of heading for a land base. I could not prevent it from flying because "CAG Duty" is automatically applied when a CAG is landed on a carrier, and it will then automatically take off to defend the sea zone once again no matter what you do. I couldn't bring in another wing to replace it until it was rebased, and there was no room on the CVL for a second wing to reinforce it. There was nothing I could do to save the CAG, which eventually ran out of Strength and was eliminated. Automatic systems like that are fine when they're optional, but when there is no manual alternative or override when the actions of the automatic function are just plain stupid under the circumstances, I find it frustrating.