A "redshirt" is a stock character in fiction who dies soon after being introduced. The term originates from the original Star Trek (NBC, 1966–69) television series in which the red-shirted security personnel frequently die during episodes. Redshirt deaths are often used to dramatize the potential peril that the main characters face.
In Star Trek, red-uniformed security officers and engineers who accompany the main characters on landing parties often suffer quick deaths. The first instance of what now is an established trope can be seen in the episode "What Are Little Girls Made Of?" (1966).
55 crew members were killed in the series. In 15 of these fatalities, the shirt color is unknown. Of the remaining 40, a total of 24 (60%) were wearing red shirts, compared to 9 in gold shirts, and 7 in blue shirts. However, over half of the crew of the starship Enterprise (239 out of 430 crew members, those in engineering, operations, or security) wore red shirts, making the redshirt casualty rate just over 10% of the redshirted crew. The comparable death rate for goldshirts was higher at 13.4%, despite the stereotype that redshirts are in the most danger (blueshirts are the safest, at 5.1%). However, redshirted security personnel (in contrast to the also redshirted crew in operations and engineering) were at the highest risk, with 20% of the security crew dying. 
The Star Trek: Deep Space Nine book Legends of the Ferengi says Starfleet security personnel "rarely survive beyond the second act break". An episode of Star Trek: Deep Space Nine titled "Valiant" (1998) also references red as a sort of bad luck omen, in which the plot centers around a group of cadets calling themselves "Red Squad", almost all of whom die in the episode. The 2009 cinematic reboot of the franchise features a character named Olson (portrayed by Greg Ellis) who dies early on during a mission; he wears a red uniform in homage to the trope from the original series.
In other media, the term "redshirt" and images of characters wearing red shirts has come to represent disposable characters destined for suffering or death.
The trope, and its particular usage in Star Trek, has been parodied and deconstructed in other media. Parodies include Galaxy Quest (1999), a comedy about actors from a defunct science-fiction television series serving on a real starship, which includes an actor who is terrified that he's going to die because his only appearance in the show was as an unnamed character who was killed early in the episode. The novel Redshirts by John Scalzi satirizes the trope, as does the video game Redshirt.