Goldfish are a popular aquarium fish, but most people don't give goldfish enough credit. The popular urban legend about goldfish having a 3-second memory (or some single-digit variation) belies the surprising level of intelligence of goldfish. The way that goldfish react to a mirror showcases interesting behaviors.
Who's That?
Goldfish are smarter than people give them credit for. However, goldfish are still not geniuses. Goldfish can perceive and react to a mirror. However, they do mistake the mirror for another goldfish (the ability to recognize oneself in a mirror is a test of animal intelligence that very few critters pass). Still, recognizing their reflection as a "goldfish" shows some intelligence.
Schooling
Goldfish are really social animals. They are schooling fish, and typically live in groups. This is especially true of their wild carp ancestors. Since goldfish live in groups, the most common reaction to the "new" goldfish they see in a mirror is to try and school with it, as they would with any other goldfish.
Aggression
Goldfish, as a species, are rarely aggressive. However, there are oddballs of every species, and goldfish are no exception. A particularly aggressive goldfish may act antagonistic towards the "new fish" in the mirror. This behavior will most often take the form of trying to chase away the mysterious newcomer around feeding time. This kind of behavior is more marked in territorial fish like the Siamese fighting fish, or betta.
Why Have a Mirror?
There are several reasons to expose your goldfish to a mirror. First, you get to see your fish's reaction, which is an interesting way of interacting with a usually hands-off pet. Additionally, mirrors can help your goldfish feel like there are more fish around -- without overcrowding your tank. Lastly, having a mirrored background to your tank can help improve the lighting. If you only have fish, this is just an aesthetic improvement, but if you have live plants, the extra light can improve their health.