Some livebearers can change gender (I've seen in in swordtails), however, in the O.P's situation, the most likely scenario is that the molly was hit before the male died and can store sperm for several batches of babies without needing to breed again.
To answer your other question...there is NO way to tell the gender of fry at birth. I'm pretty sure this is the case for most fish, and is certainly the case for livebearers. Female livebearers, especially guppies, can be pregnant almost before you can tell their gender if they have been with a male, and, if hit once, can produce up to 9 batches of babies off of that one breeding. This is why virgin females are worth so much more, you know positively which male impregnated her. If you buy a female guppy from a pet store, even if she is very young, chances are good that she's pregnant already. Usually, with fancy gupppies, I can tell the male fry before they get their gonopodium by the fact that they color up brighter, faster than the females. If there is no difference in color in the genders as an adult, like with many swordtails and mollies, you have to wait till the males develop their gonopodiums.
To answer your other question...there is NO way to tell the gender of fry at birth. I'm pretty sure this is the case for most fish, and is certainly the case for livebearers. Female livebearers, especially guppies, can be pregnant almost before you can tell their gender if they have been with a male, and, if hit once, can produce up to 9 batches of babies off of that one breeding. This is why virgin females are worth so much more, you know positively which male impregnated her. If you buy a female guppy from a pet store, even if she is very young, chances are good that she's pregnant already. Usually, with fancy gupppies, I can tell the male fry before they get their gonopodium by the fact that they color up brighter, faster than the females. If there is no difference in color in the genders as an adult, like with many swordtails and mollies, you have to wait till the males develop their gonopodiums.