The key here is proper allocation of the contributed goodwill. If that has been done then gain will properly flow from from the basis of partnership capital accounts upon sale/liquidation of the partnership, or sale of the contributed asset.
There is no special tax rule for contributed goodwill, it is treated like any other 704(c) property which the amortization or depreciation is allocated to the partners under reg 1.704-3(b) in respect to a Built in Gain.
The allocation is made to prevent disparity between the book and tax capital accounts of the non-contributing partner as well as to prevent shifting of tax attributes among partners. Basically, the contributing partner recognizes the built in gain over the remaining life of the asset through a reduction in the amount of amortization or depreciation allocated to him.
Here is a basic example where A and B form a 50/50 partnership. A contributes goodwill with fmv of 10,000 and basis of 5,000 = BIG of 5,000.
B contributes 10,000 in cash.
The built in gain is reflected in the difference of A's book capital account of 10,000 and tax capital account of 5,000; while B has a 10,000 balance in both book and tax capital accounts.
Now assume the contributed asset has 10 years remaining life. Therefore the book amortization is 1,000 and tax amortization is 500 for the partnership. The book amortization is allocated 50/50; therefore each partner receives 500 in book depreciation.
However, under the reg, the tax amortization is allocated first to the non-contributing partner B in an amount equal to his book amortization of 500.
Therefore in this case, B is allocated the entire 500 of tax amortization and A receives zero.
Now look at the effect on A's capital accounts. His book capital account has been reduced from 10,000 to 9,500 by amortization while his tax account remains at 5,000 since he was not allocated any amortization for tax purposes.
So now the amount of BIG reflected in the difference between A's book and tax capital account has been reduced to $4,500.
If you fast forward the calculations to 5 years his BIG will be reduced in half to 2,500 and at the end of the ten year life of the asset, he will have recognized 100% of the BIG through his reduced allocation of amortization.
While that was a simple example it can get a lot more complicated and additional rules kick in. For example there might be not be enough income to cover partner B's amortization; or there might not be enough tax amortization to cover B's book depreciation. Those situations are covered in the reg.
Now in answer to your question, when the partnership is sold, any remaining BIG will be recognized by the contributing partner as a difference in book/tax capital accounts; provided amortization or depreciation has been properly allocated. If not you have "BIG" PROBLEMS to resolve.
That is the correct answer!