Goodwill can have a number of meanings but this brief article contemplates it's meaning as a financial asset.
Goodwill that appears on a balance sheet is always 'purchased' Goodwill. That is, it is not generated by some mechanism internal to the company and then created as an asset.
Goodwill normally arises from the purchase of a business where the price paid exceeds the fair value of the net assets acquired. Consider the purchase of an extremely profitable business that had a very low asset base. If the buyer paid, say, $2 million for a company whose net assets where only worth $1.3 million, the $700 thousand difference would be treated as goodwill.
On a strictly theoretical basis, Goodwill is the present value of the superior earnings stream of a business, capitalized in perpetuity. Put another way, you would only pay $2 million for a business with assets of $1.3 million if you thought you would make a lot more money than that sort of investment would normally generate.
Managment must review the asset value of Goodwill every year to determine if it is still a legitimate asset. If it is not, the asset must either be reduced or written of completely. Reverting to the previous example, suppose the business purchased had a competitor that opened a location just across the street, and that ongoing profits would be reduced. Management would be required to reduce, if not write off completely, the value of Goodwill.