Why is it the case that male animals have external sex organs and females the opposite?

I understand that in humans and probably other animals the male sex cells, sperm, survive better in cooler temperatures and so the sex organs are outside the body to regulate temperature.

But why is it this way and not the other way round?

  1. Why are (to my knowledge) all animal ovum better suited to warmer temperature and sperm cooler?

  2. Could it not be reverse in some species and for that species to have external ovaries and internal testicles?

  3. Are there examples of what I'm thinking of above?

  4. There is probably an evolutionary answer for this being that some ancestor to all mammals had external male sex organs that preferred cooler temperatures and so that's why that seems to be the common pattern. If that is the case, do we have any idea what that ancestor might be?

Alternatively it may be the case that the way sperm exist they're always going to prefer cooler temperatures.