The female egg can survive up to 24hrs before it disintegrates. Male sperms can last up to 4 or 5 days. Female sperms are heavier, sturdier and swim slower, but it can last longer. Male sperms can swim faster, are more nimble, but they don't last as long.
With these characteristics, if you plan to have a girl, u can afford to *ahem* a couple of days before you ovulate, then the remaining female sperms will be there waiting for the egg to arrive. Male sperms may have died off by now.
If you plan to have a boy, then *ahem* on the day you ovulate. The sprinter male sperms will reach the egg faster than the female ones, and get to fertilise the egg first.
The trick is to pinpoint when a woman ovulates. An additional complication is some woman can have regular period without ovulating ie without the egg being released.
An ovulation kit helps. But you got to be diligent in the testing, cos you may just miss the signs before you ovulate and then get a negative result.