Realised losses offset realised gains and, beyond that, a limited amount of ordinary income, with the remainder carried forward. The mechanical effect on markets is a seasonal supply of selling in the year's worst performers during late November and December, and a tendency for those same names to bounce in January once the pressure lifts.
The wash-sale-rule is the constraint: buying the same or a substantially identical security within 30 days before or after disallows the loss and rolls it into the new cost-basis.
Example: $40,000 of realised gains and a position down $25,000. Selling it cuts taxable gains to $15,000, saving $5,000 at a 20% rate. Re-buying 31 days later keeps the deduction but risks the move in between.
Related: wash-sale-rule, cost-basis, tax-lot, long-term-capital-gains, capitulation