How do you know if a fish is about to die?

Wow i have alot of experince in that as i have had alot of fish who have died on me, most recently lapis my betta fish, but he died while i was asleep, a few ways to tell are:

1: sometimes you can catch your fish on its side, when i see that i tap the glass once or twice near where my fish is to make them move to show they are still alive

2: if you have more than one fish in the tank, say like 3 or 4 one or two of the fishes will protect the sick one from the others.

3: if you catch one of multipul fishes dead in the tank it is likely the others will get sick and have a chance of dying too.

and 4: the illness ich can be caught by fish and kill them, the most notice able sign of ich is the scales of your fish bleach white starting around the gills and spread out over time, if you notice this at a early stage it can be treated, if gotten when body has gotten bad and almost completely white then it means you fish will most likely die.

i hope this helps, i dont like it when fish die, mainly my own, i have had what 6 or 7 fish die on me and i dont want to see any more go, it hurt most when lapis died cus i was crying my head off for a while cus lapis was really my only friend.

Hope this helps!