As said before, a Commissar is meant to lead by example and nearly everyone does to varying degrees. Seeing a normal man/woman (Not a Space Marine or Sister of Battle) carving through armies of heretics and foul aliens will inspire mortal men to great feats. But, just like in the real world, insubordination, malcontents, defeatists and cowards are still a part of the military. Normally a Commissar's mere presence is enough to prevent such issues, but sometimes punishment is required and on the battlefield there is only one way to silence such parasites. Sadly Commissars like Gaunt and Cain are relative minority. Many who are inducted to be Commissars see their word as being the word of the God-Emperor and any who disobey must be silenced. Older Commissars like Old Man Yarrick know that shooting men can backfire and only do so when required. Younger Commissars generally get a bit trigger happy.



On another point you made on moral and numbers, it depends. If you have numerous individuals who will shoot you for retreating and know that if you kill said individuals you'll all be shot, you're more inclined to fight as there is a better chance to survive fighting the enemy with these men/women at your side. Also you're driven by self preservation knowing that if you run, you die, so fight. As for numbers, remember a standard Imperial Guard infantry regiment can be upwards of 5000 men. Shooting one man will not disrupt the unit. In the book 'Imperial Creed', Yarrick's mentor likens a regiment to a hand with a gun. Cut off a finger and you shall make firing the gun harder. However, should a finger grow gangrenous, remove it and step in to replace it. Again, the Imperial Guard has billions of men and their strategy is attrition and overwhelming firepower. One or two lost here and there will do very little.



As for DoW, at that point the General was talking and the man interrupted. Usual punishment would have been flogging. However, in the scenario they were in, they had no time or patience for anything. "But, sir..." comes with a bad connotation as well in a scenario where you have an army busting through your defenses. The commissar probably thought he was about to voice a defeatist/treasonous remark about their disadvantage or some such. So, kill him before he ruins morale. Yes, it does back fire when the Guard turn on the General after the Commissar is killed, but those men are the worst kind of soldiers who know nothing of loyalty. In the Space Marine campaign, Thule executes every man who turned on the General to help him. They are traitors, they General wasn't so he let his men go and killed the traitors.



Overall, to answer you original question about Commissars, they shoot only when someone voices a defeatist remark on the battlefield or disobeys an order from their superiors. One other situation they will shoot someone is if an officer breaks under pressure and panics or is totally inept. In those settings, they Commissar will shoot them to save the lives of the men under the officer. Commissars are forced to walk a generally unpopular path, but you get men like Cain and Gaunt who are generally respected (doesn't stop the Tanith from wanting to put a knife in Gaunts back though).