Ant sex is determined by the sets of chromosomes. If they have pairs of chromosomes they are female. If they have a single set they are male. A fertilised egg has pairs of chromosomes, one set from the mother and and one from the father and thus develops into a female. An unfertilised egg has one set of chromosomes only from the mother and thus develops into a male.
Interestingly this means a male ant cannot have a son and has no father. However they can have a grandson and they have a grandfather.