The most accurate way (I believe this works for most species of fish) is by examining the otoliths. But this of course can only be done on dead fish. This is because otoliths are the inner ear bones of a fish. They are composed of calcium carbonate and protein and function as sound receptors. They also help the fish maintain balance and orientation.
There are 3 pairs of otoliths or ear bones in the inner ear of koi and goldfish (I am not sure about other fish species). The largest pair, the sagittae, are routinely used for determining the fish's age. What the biologist does is to count the number of visible rings under a microscope. White bands are formed during the spring and summer months, while darker bands are formed during winter. One white band and one dark band thus equals one year. Thus by counting the total number of bands (white and dark) under a microscope, we can accurately determine the age of a fish. But this would mean killing the poor fish to remove its ear bones!