Banks go bust for two very different reasons. The first is that they are no longer making a profit on their activities and so, like any other firm, eventually their creditors will force them into bankruptcy.
The second pattern is where a bank suffers a run on its deposits so that it is no longer able to meet the demand for cash from its depositors despite the loans that it has made remaining profitable. It is this second pattern of failure, which is driven by irrational panic, that modern central banks seek to prevent by being willing to act as 'lender of last resort'. This adds stability to the crucial plumbing of the economy, because if the banks have been adequately well run then their loans' long term value should be enough to pay off the depositors.
Note that there is always a risk of panics associated with banking; they inevitable borrow short - from depositors who want immediate access to their money - to lend to creditors who want to be certain their loan won't be called in overnight. Noone has come up to a solution to this problem, but the present system of bank regulation and 'lender of last resort' does generally work well enough.