When a credit lender declares bankruptcy, the bankruptcy court appoints a receiver. This is an indepentant party which handles the finances of the bankrupt credit lender, and it is done under the supervision of the bankruptcy judge. That party collects money from the borrowers, and uses the money to pay the outstanding bills which the credit lender owed.
In many cases the lender is only a servicing agent and does not fund the loan. If the servicing agent folds and is FDIC insured, the lender is taken over by the government and nothing changes. If the servicing agent is not FDIC insured and closes it doors, the investors that funded the mortgage will find a new servicing agent.
If the investors that fund the loan folds, other investors will purchase those loans and may or may not change servicing agents.
In any case, you will be notified who the new servicing agent will be.
When a lender folds then the business is bought off by another lender and you pay to them.
Don't worry... they will send you a letter explaining that they "bought" your debt and that you need to send the payments to such and such address from now on.
Sorry.... it doesn't just go away....