The brain and the nervous system
The brain is relatively basic in comparison to advanced animals (no cerebral cortex, seat of consciousness). However, certain parts of the brain are very developed (the sense of smell in particular).
Goldfish do have a memory according to numerous pieces of research: they can remember things for several months, so the idea that “goldfish have a memory of three seconds” is a myth.
Some goldfish have been trained to carry out simple tasks: for example, finding the exit in a maze, pushing a lever or a tiny ball to a goal, responding in various ways to certain colors of light or to certain sounds.
There is no need for experiments to realize that goldfish quickly learn to associate food and their owner, the precise place in the aquarium where food is given and even the time at which food distribution takes place if they are fed daily at the same time.
The nervous system is relatively underdeveloped compared to mammals. However, that does not mean that fish do not feel or even remember pain, contrary to what we have long thought.

Photo: bfraz (licence CC BY-NC-SA)
Important: the comments area below is not for urgent queries about fish health but for general feedback, comments and questions, as we normally check comments twice a week. Therefore, it you have a question about a sick fish, it is advisable to first check the health and disease section. If you do not find the answer to your questions there, please post your question in a fishkeeping forum, which usually allows to get help in a timely manner, or contact your local vet.