Probably was wired for three way (multiple switches controlling) originally.
If that black wire was loose before you pulled the switch, that's a clear indication of prior hack working on it, so many bets are off. It looks like it may have previously been in the push in terminal under the black screw.
Start by verifying white (neutral) and bare copper (ground) are all connected securely.
Then, you can use wire nuts or even alligator clips temporarily to connect various configurations of wires (and operate other nearby switches in the house) to figure out what's going on, turning power on and off as needed.
On the switch, it's rare to see a red without either have a three way switch or a split outlet (where half is switched and half always on.