I had a really old tetra fish, around 7 years old, who was getting weak. The other fish were helping him get food and were supporting him whenever he was swimming around. A few days later, the fish died. Is there some way that fish are able to figure out that one is weak and will be dying soon?
A study from Yale indicated that tadpoles would stay away from a sick tadpole because they knew they would become infected if they were around it. Yale Study Although this doesn't apply directly to fish, this is found in the animal kingdom a lot. Runts being kicked out of the litter. Mothers licking the wounds of their children. I wouldn't think that a fish would have the capacity to do this, but if a tadpole can, I wouldn't see why not.
To answer your question: "Is there some way that fish are able to figure out that one is weak and will be dying soon?". Yes, you could do your own study, by monitoring healthy fish and taking notes; then drop in a fish that is unhealthy and seeing how they react. If you can recreate your situation multiple times you have support for your hypothesis. Although introducing a dying fish may not be the same as a "friend" to to the healthy fish dying.
Good luck in your findings!
The majority of the animal kingdom, including fish but not dolphins, do not have a sense of identity or self-recognition . So they likely do not experience an abstract awareness of their eminent demise.
While they may not be abstractly aware of their demise, all vertebrates have a nervous system and experience pain and stress. Even animals that do not have self-recognition have been known to go to great lengths to attempt to survive.