The goal of a pairs trade is to take advantage of whatever happens. Market goes up, you’re good. Market goes down, you’re still good.
The strategy involves finding two investment vehicles that are highly correlated. So...two stocks that always trade together (when one goes up, the other goes up by a similar amount; when one goes down, the other follows suit). Or two sectors that track each other closely. Or two commodities. Or it can be two separate asset classes that have a high correlation. Ice cream futures and shares in sprinkles manufacturers, etc.
Then, you take a long position in one of the two correlated assets, and a short position in the other. You are now market neutral. You are long ice cream futures and short shares of the world's largest sprinkle manufacturer. Temperatures skyrocket. Ice cream sales through the roof. Your ice cream futures pay off big.
However, if things went the other way, you'd still be covered. If it starts snowing in July and ice cream sales plummet, you make money anyway: your short position on sprinkles will pay off.
Pairs trading is often used as an arbitraging technique. You think Coke is overvalued by the market and Pepsi is undervalued. So you short Coke and go long Pepsi. You make money as the valuations of the two soft drink makers converge. You're protected from market risk, because it doesn't really matter if the stocks go up or down. They can both fall, but if Coke falls faster than Pepsi, you still make money.