Airlines stop flying for several reasons. A common reason and major cause is financial difficulty. Airlines operate on tight margins and competition in the industry can be fierce, so when events like economic downturns, rising fuel costs and unexpected maintenance expenses occur, it can tip the scales towards bankruptcy.
Another reason is due to mergers and acquisitions. Airlines sometimes merge with others to create a stronger presence within the market. This will however lead to the disappearance of one of the involved airlines.
A less common reason is safety issues. If an airline encounters a series of accidents resulting in the loss of public confidence in safety standards, it can force the airline to ground its fleet.