First and foremost fin-rot is due to bacterial infection, if of course its not as a result of simple nipping hence being certain to differentiate between fin-damage (treatment; good water conditions, melafix) and actual fin-rot (decent gram+/gram- bacterial medication).
Obviously this is connected to what has been said already, any fish suffering stress from poor water, nipping, poor-nutrition, aggression or various other factors is at a greater risk of infection than an unstressed, healthy fish.
That doesn't mean there absoultely has to be another factor, but it is more then likely, if you eradicate all the possible cause of stress and go with the aforementioned treatments you should be fine.
The bacteria commonly related with fin rot are;
Aeromonas, Pseudomonas, Flexibacter, Vibrio.
Personally i don't believe that once fin rot has settled in that Melafix (as is commonly reccomended) is a suitable, or strong enough treatment.
Although this is obviously a topic for discussion.