Can you explain "tax-loss harvesting" ?

I read the following advice in the newspaper’s financial section.
But I’m not sure what it’s telling me to do or avoid exactly.
Can somebody put it differently?

This is a way to declare a loss on a holding, then 30 days later buying it again. During the interim you buy something else that will perform similarly to the original holding.

The main reason you would want to realize a loss is if you have gains during the same period. The loss allows you to offset the gains for tax purposes.

Buying other holdings in the interim allows you to take advantage of any gains that might occur during that time, then you make a repurchase so you end up as if you had never sold the stock in the first place.

You have to wait 30 days because if you sell stock then buy the same stock within 30 days, the IRS won’t let you take the loss; they call it a “wash sale” which means even though there is a transaction on the books, the transaction was a sham just for tax purposes and doesn’t count as far as taxes are concerned.