Certain windfalls and profits are considered capital gains. Here’s how to determine what you’ll owe.