What happens when a company goes under and the yearly fee can no longer be paid? Has a gTLD ever been resigned?

From the ICANN site, 154 gTLD agreements have been terminated. I'm not sure how many due to non-payment, but https://domainincite.com/30105-icann-to-terminate-five-new-g... indicates that at least some have been due to non-payment.

https://www.icann.org/en/registry-agreements?sort-column=top...

".active" is no longer active...

It’s part of the initial process for you to develop and file contingency plans in case happens. Most likely delegating to a different company in one way or another.