The red wire on a light switch is typically a traveler wire used in a three-way switch configuration. In a three-way switch setup, two switches control the same light fixture, and the red wire connects the switches.
The red wire is usually connected to the traveler terminal on the switch, typically a screw that is a different color than the other terminals. The other two wires on the switch are typically the hot (black) wire and the neutral (white) wire.
It's essential to remember that a light switch's wiring layout may vary depending on your home's age and local electrical codes. If you are uncertain about the wiring in your light switch, it is always smart to seek advice from an authorized electrician so that the connections abide by safety protocols and meet all code requirements.