Tax loss harvesting is the act of selling assets that have lost value to offset gains on assets that have appreciated in value. This has been a popular strategy among large institutional investors for some time, but it has recently become more mainstream and available to individual investors as well.
Tax loss harvesting is done during the year, and it's done when you have capital gains. If you don't have any capital gains, there's no need to tax loss harvest because you'd be selling assets for no reason (you won't have any gains to offset). If your capital gains exceed your capital losses, you're not doing anything out of the ordinary: if you sell an asset for more than you bought it for, you have a taxable gain. When it comes time to file your taxes at the end of the year, though, you can lose some of that profit—to the benefit of your portfolio—if you tax loss harvest.
Tax loss harvesting allows you to take advantage of how tax laws are structured. When two similar securities are purchased within 30 days of each other and sold within 30 days of each other, they're treated as one security. If they're sold at a different price than they were purchased at, a capital gain or loss will be created.