Goldfish hover near a shelter at the bottom of the tank for short periods throughout the night when sleeping. Goldfish don't have eyelids, so when sleeping it can appear that they are just being inactive.
Whether a small goldfish in the aquarium tank or a large Koi in the pond, goldfish do sleep. These fish are diurnal creatures and tend to do most of their sleeping at night. It's possible that the owner may never see their goldfish sleeping because they do it at night. Also, goldfish tend to sleep in short periods throughout the night rather than one long multihour segment of time.
Since goldfish don't have eyelids, it is important that they get a period of darkness each night. Remember to switch the tank or pond lights off at night so that the fish are not disturbed and get better rest. In the long term, fish who have trouble sleeping may get stressed and be more prone to illness.
When goldfish sleep they will seek out some type of shelter close to the bottom of the tank, usually the aquarium plants placed in the tank. The fish may be tilted slightly forward with their head lower than the rest of the body. While sleeping, goldfish may move their fins very slowly to help them remain in place.