To tell the difference in most of the common livebearers you examine the anal fin, the one right in front of where the wastes come out. Warning, this is an extreme closeup of a fish that is only about 3/4 inch long so it's a bit fuzzy.
This is an example of a female fish. The triangular shaped fin says it is a female.
This is an example of the same species of male fish. The elongated anal fin says it is a male.
These happen to be Heterandria Formosa but the fin shapes are the same on guppies, swordtails, mollies, platies, limias and lots of other of the most common livebearers.
Goodeids also can be distinguished by the shape of the anal fin but in a male goodeid, the male looks like the female in these pictures except that the anal fin looks like it is split in two instead of being skinny. The first 2 or 3 rays, bones, in the goodeid anal fin will be in the front part and the rest of the rays will be in the back part.
The common name for goodeids is splitfins for that reason.
With these examples you should be able to tell very quickly if you have a male courting a female.