It takes a lot of time and determination, but the payoff from the IRS could be huge. Here’s how to do it.