How does stunning work?
How do I stun aliens? I've been whacking away on one for a few turns, and I've done a couple hundred of what appears to be stun damage, but 30 normal damage was enough to kill the alien. Why can't I stun them?
Some enemies, such as the robotic Andron, are immune to being stunned. However, the game's UI does not give you good feedback about this, as you'll see the "blue" damage occurring. However, no amount of hitting them with stun batons or gas grenades will knock them out.
For enemies that are not immune to stun, it appears that every time you do "blue" damage to an enemy (such as from a shock grenade, electromagnetic grenade, or stun baton), there is a chance that you will render them unconscious. Additionally, gas grenades seem to cause a chance of immediately knocking out a unit when they first enter it (either by walking into it or by being present in the grenade's area of effect when it explodes), as well as having a chance to cause a knockout at the start of the unit's turn if they are standing in the gas.
How exactly the "chance" to knock them out works is a bit of a mystery to me. I swear I've seen enemies go down after taking 10 blue damage. Posts on the Xenonauts forums such as this one by a developer seem to indicate that the damage is really simply subtracting from their "blue" health pool, and when they hit zero they pass out, though this is also a post from 2013 and things may have changed since then.
To test this, I've run my troops into the gas and it always seems to be an all-or-nothing effect for them. Their morale bar never drops while they stand in the gas, though they'll stop and you'll hear them make an "ugh" sound upon first entering it. If I leave them in it, they might stay up until it disperses. Or they might suddenly drop unconscious. But at no point in between do I see their morale bar drop. That may simply be a UI error, or blue damage not corresponding to troop morale. All forum posts seem to indicate that the damage is cumulative rather a chance effect.
Anyway, the short version is that you just need to throw enough stun damage at enemies and eventually they'll go down, whether it's due to "stun hp" loss or just from random chance catching up to them. Just be aware that some enemies, particularly those that say "Resisted" when you throw a gas grenade at them, seem to be immune to stun. Note that you can even incapacitate enemies right from the first crash site of the game if you toss enough flashbangs at them.