Here’s a primer on how capital-gains taxes work when you sell your home or other investment