Hermaphroditism in Fish
Hermaphroditism can be broken down into two broad categories: protogyny and protandry.
Protogyny is a sex change from female to male. Protogyny is displayed as a normal part of the life history of 14 fish families, including wrasses and parrotfishes. This means that in these families of fish, it is expected for an individual to began its life as a female and then switch to become a male later in life.
Protandry is a sex change from male to female, and is less common in fish than protogyny. Protandry is only observed in 8 different families of fish, including porgies, damselfishes, and moray eels.
Sequential hermaphrodites function as one gender and then switch to the other, often as a result of changing population dynamics . Sequential hermaphrodites only exist as one sex at a time, a key distinction from other types of hermaphrodites. The evolutionary advantages of sequential hermaphroditism are best explained by the size advantage model.
Size Advantage Model
In generalized terms, the size advantage model states that individual fish should change sex when the other sex would have a higher reproductive value at that stage in life.. In mating systems in which large males monopolize the spawning of females, larger males have higher mating success than smaller males. With such a population dynamic, size is less important for females. In this mating system, it can be beneficial to begin life as a female when small and then change sex to a male once a large enough size is reached to maximize mating ability. A mating system in which large males monopolize the spawning of females thus favors protogyny, or the sex change from female to male.. In other mating systems where no monopolization occurs, there is no size advantage for males to be large. However, in systems where random fertilization occurs, it is beneficial for females to be larger because larger females are able to hold more eggs. This type of mating system would favor protandry, or the the changing of sex from male to female. A male would undergo this sex change once the male grows large enough to gain a reproductive advantage from being female .
Hermaphroditism in Wrasses and Parrotfishes
Hermaphroditism, or specifically protogyny, is observed as part of the normal life history of both the Wrasse and Parrotfish families. In these families of fish, a dominant male defends a group of female fish from other males. Only the dominant male mates with multiple females in the group, an example of polygny. When the dominant male dies, the largest female in the harem changes sex and becomes the new dominant male. This is an example of sequential hermaphroditism. 
Simultaneous hermaphrodites exhibit both female and male gender roles at the same time. This means that an individual fish may perform both male and female reproductive roles at the same point in time . Simultaneous hermaphroditism is only advantageous when population density is very low. Since it is difficult to find a mate when population density is low, it is advantageous for an individual to be able to mate with any other fish it may come into contact with, regardless of sex. Simultaneous hermaphroditism is most common in deep-sea fishes. This reproductive strategy can be evolutionarily advantageous, but is only sustainable if male-type "cheating" can be avoided. "Cheating" is when individual fish fertilize the eggs of multiple simultaneous hermaphrodites without expending the extra energy to produce eggs themselves. This would lead to a population where all of the individuals function as males, hurting the reproduction of the population as a whole
Anti-Cheating Strategies in Small Sea Basses (Serranidae)
Hamlets undergo a practice called "egg trading" in which a pair of fish alternate sex roles over the period of mating. This behavior forces both individuals to expend energy into egg production so that neither individual is forced to produce all of the eggs alone. Other basses in the genus Serranus undergo mating just before nightfall so that simultaneous hermaphrodites functioning as males will not have enough time to fertilize multiple females. This strategy theoretically prevents individuals from functioning solely as males without expending considerable energy themselves in egg production. 
- Warner, Richard R. "Mating Behavior and Hermaphroditism in Coral Reef Fishes." American Scientist 72.2 (1984): 128-36. Web.
- Sumich, James L. An Introduction to the Biology of Marine Life, Seventh Edition. WCB/McGraw Hill. 1999.
- Hixon, M.A. "Coral Reef Fishes." Encyclopedia of Ocean Sciences 2 (2009): 655-59. Web.