lol... this is common sense. You already got the understanding correct about males having to pollinate females.
Most of the weed with seeds are from outdoor landraces or commercial brick weed which are grown in the outdoors where males and females are probably grown together or male pollen from neighbouring growers travel with the wind and pollinate an all female field. You can also get hermaphrodites that seed itself and other surrounding plants.
Now if you are talking about homegrown bud containing seeds, it is from either stray pollen from males floating about, hermaphrodites or a couple bananas (type of hermaphroditic defense mechanism to carry on a seedline) from stress.
It's not like the growers intentionally grow weed with seeds in it, probably their growing environment has some faults like light leaks and severe stress from negligence or whatever.
That's why if you find some seeds in some great weed.... grow them out, but understand you do not know what pollen created the seed so you might get a selfed seed, an unknown cross or a full hermie. But they're good for new growers to experiment and learn before spending money on quality genetics.