The tortoiseshell coat in cats is brought about by an interaction between two genes. One gene is on the autosomes (the chromosomes that come in pairs), and codes for every colour except ginger. That is, it has alleles for black, white, tabby, and so on. (In fact there is not just one autosomal gene, but for simplicity it can be regarded as one locus, behaving according to familiar Mendelian genetics.)

Ginger coat is controlled by a gene on the X chromosome. This has two alleles, ginger (symbolized G) and non-ginger (g). As it's on the X, females have two, therefore three possible combinations (GG, Gg, gg) while males have only one copy and the two possibilities are just G, g.

The X-chromosome gene is epistatic to the autosomal one, that is loosely it is "dominant" over other colour genes. Or to be more precise, the ginger allele is "dominant".

A male's two possibilities are: he has G on his X, so he's a ginger cat, regardless of his other genes. But if it's non-ginger g then this is disregarded, and it's the other gene that makes the cat black, tabby, grey, or whatever.

A female homozygous for ginger (GG) is a ginger cat. A female homozygous for non-ginger (gg) has no ginger in her coat, and is black, white, tabby, or whatever as the other genes dictate.

A heterozygous female, with mixed genotype Gg is partly ginger and partly non-ginger. The non-ginger patches are governed by the other colour gene(s). A tortoiseshell cat is in fact a mosaic, and of course can only be female. (I learn from yam's write-up under the alternative name calico that males can get the pattern if they have some rarer genotype such as XXY.) Not that the G is not in fact dominant over its own allele g.

The frequency of the ginger allele is about 17%, so 17% of male cats are ginger. Only 3% of female cats are ginger (= 17% x 17%), and 14% are tortoiseshell (17% x 83%).