In Goodfellas the MOB killed Tommy due to his act of murdering a "made man" - Billy Batts. But if they figured out that Tommy did the killing, wouldn't they also have known that Jimmy and Henry were involved, too? So why were they not punished?
Because when Tommy exploded at the bar after Batts' comment, the bar was full of people including Batts' boys. It was also public that Henry was trying to prevent a fight and got Tommy to leave. The exchange between Batts, Henry and Jimmy was pleasant and apologetic. There was nothing to give suspicion to them.
In the versions I've seen there was no explanation as to how they discovered that Tommy did it so we have to assume that the "MOB" assumed since Batts had not turned up in so long that he is dead and decided Tommy was responsible since he was the last one seen having an altercation with Batts.
But they also killed Tommy "for a lot of other reasons" too. So this probably made it easy to determine he was the culprit.
Tommy was a bit of a loose cannon, and a bit unpredictable to even his closest friends. You remember the "Funny, how??" scene? Even Henry was a bit nervous at first, and they knew each other from childhood (they got pinched together for selling cigarettes). Tommy also shot Spider just because he made a joke. I think the Luchese family had many reasons to ice him, but it wasn't until Batts disappeared that they had enough ground to do it without question. It also made for a nice peace offering to the Gambino family.