The use of a building, structure, or land, existing and lawful at the time of the adoption of a zoning regulation, or at the time of an amendment of a regulation, may, except as provided in this section, be continued, although such use does not conform with provisions of such regulation or amendment. Such use may be extended throughout the same building if no structural alteration of such building is proposed or made for the purpose of such extension. If such nonconforming use is in fact discontinued for a period of twelve months, such right to the nonconforming use shall be forfeited and any future use of the building and premises shall conform to the regulation. The city council or village board of trustees may provide in any zoning regulation for the restoration, reconstruction, extension, or substitution of nonconforming uses upon such terms and conditions as may be set forth in the zoning regulations. The city council or village board of trustees may, in any zoning regulation, provide for the termination of nonconforming uses, either by specifying the period or periods in which nonconforming uses shall be required to cease, or by providing a formula whereby the compulsory termination of a nonconforming use may be so fixed as to allow for the recovery of amortization of the investment in the nonconformance, except that in the case of a legally erected outdoor advertising sign, display, or device, no amortization schedule shall be used.