Well, that is a topic that legal scholars write treatises on and judges write sometimes lengthy opinions on. I think there are courses offered that could be taken on an audited basis at many schools for those interested in learning more about the complex issues involved with admission of evidence. Each state will have its own rules of civil procedure, and so that would be 50 links and I don't have the time to link them all. Here's a summary of New York's (taken from a state judicial website), but of course this is a simple overview.
https://www.nycourts.gov/JUDGES/evidence/ . If in federal court, the federal rules of evidence apply, but most sexual related criminal cases are not federal cases. However, many state evidence rules are somewhat based on the federal rules, so here is just one link that give some info about that:
https://www.rulesofevidence.org/. Not fun weekend reading though (especially not when trying to catch Walleyes, yes, I know not the right month for Walleye catching...).