I gently pick up the fish and feel along the gill plates and the rays of the pectoral fins. If you feel any tiny bumps - 95% chance the fish is male. These are breeding tubercles and are mostly present on males. I HAVE had the odd confirmed female have a few though, but ONLY on the gill plates and very few. You can always feel the little bumps quite a ways before you clearly see them.
If you are not comfortable handling the fish, LOOK extremely closely and see if you SEE any whitish bumps on those areas. If there are any bumps or the pectoral ray looks "thickened " then the fish is likely male.
Another way to tell is by VENTING the fish, this is also best done by picking the fish up and turning it over. A circular more inward vent is generally a male. A more oval outward looking vent is a female. More mature females can sometimes have an OUTTIE vent that can be seen when the fish is swimming.
Females also tend to be a bit asymmetrical when viewed from the top. The right side will generally protrude a bit more than the left side. This is not always a surefire way to tell though.
With young or small goldfish, sometimes you just have to wait and see. You cannot go by color or tail length or anything like that with goldies.
When the fish become sexually mature, and it is spring, the males develop small white bumps on the side of the gill covers and on the edge of the pectoral (side) fins. The females don't have these white bumps, which look like white spot but are only seen on the gill covers and pectoral fins.
Female goldfish eat more than males of the same size and they get fatter than males.
To encourage goldfish to come into breeding condition, keep the in cold water (less than 20C) for a few months and then increase the temperature. The fish will come into breeding condition with the rise in temperature and start to develop the spots.