The term "Red Shirts" came into use in the second half of the 60s, after the popular television series "Star Trek" was shown in America. Characters in the show wear Starfleet uniforms, black pants and a yellow, blue, or red jersey, depending on the unit. Red jerseys are worn by members of the operational link: the engineering service and the security service of the spacecraft, on which the characters of the series roam the Universe. Audience research showed that the adventures of space travelers were interesting to viewers only when there was danger and risk of death of the characters.
Due to the fact that the producers of the series could not exchange the main characters, and the viewers, in order to maintain the rating of the NBC channel, had to be kept in an interested state, it was decided to sacrifice minor characters that were "updated" in each next episode. In each episode, the heroes go on another dangerous adventure, from which not everyone is destined to return. The key characters, as well as those whose existence is necessary for the further development of the plot - dressed in yellow and blue sweatshirts - with minimal risk to their lives go through any trials, while their fellow travelers in red die an agonizing death under a variety of circumstances.
The only exception in the entire series is Scotty, but he is the chief engineer of the ship, and his continued existence is necessary for the normal trouble-free continuation of the flight. The trend soon became apparent to viewers, who calculated a survival formula for the characters in the show, which later became known as the Red Shirt Rule, according to which the probability of survival for characters in yellow jerseys is 100%, while the probability death for characters in red jerseys is also 100%.
This cinematic trick is called the "foundational colors", in which the yellow jersey distinguishes the command link, the blue jersey - the researchers, and the red one - those who very soon will die a terrible death. In the series, a red sweatshirt performs roughly the same function as a red rag for a bull. For those crew members who left the ship in a red jersey, this automatically means that they will not return back on board.
It is interesting that this circumstance in the series, however, differs from the modern traditions of military heraldry, where red is the "commander's color" and yellow is the color of service specialties.