"Can illegally obtained evidence be used in favor of the defendant in a criminal case?"
No because illegally obtained evidence is supposed to be prevented/struck.
But if it gets in, then the court has been defrauded into allowing it in.
But, in general, if somehow it did get in, it means to be used to convict:
And that rationale for that is that it's been unlawfully added to record via fraud upon the court having occurred, which means somehow prosecution managed to get defense to be ignorant (extrinsic fraud upon the court, I presume) and have defense get it in for prosecution's own benefit to convict.
Imagine this:
- A case for an alleged theft has been put against defense.
- Defense didn't commit the alleged crime (was never at the scene) but thinks that some facility has video recording evidence to prove-up defense not being guilty.
- Defense breaks into the said facility and gets video recording evidence of not having committed the offense.
- Defense asserts in court that defense managed to lawfully acquire the evidence and that it should be admitted into record to disprove any of prosecution's claims of guilt.
- The judge accepts defense's alleged evidence and admits it into record.
Somehow... somehow defense has been misled to thinking it is a good idea to go about getting that alleged evidence. And that misleading managed to go about prosecution's overall center of gravity being used in such a way to deceive defense into thinking that it would be a good idea to get get that recording, such as to enter it in the case. There are two adversarial parties: Prosecution and defense. And both have an overall center of gravity that each uses to combat each other in court relative to alleged facts. Relative to prosecution's overall center of gravity, prosecution had the overall center of gravity that managed to keep defense deceived into thinking it was worthwhile to get get that alleged evidence of not being guilty. Fact is, though, defense ought to have been more focused on using 5th amendment protections rather than seek to enter ANYTHING into the case: Getting rid of things rather than adding things.
"In a criminal trial, when can evidence in favor of the defendant be thrown out on the grounds that the evidence was obtained illegally/illegitimately? What is the rationale for that?"
There is never evidence in favor of the defendant unless it's part of the grounds to vacate judgment, dismiss the charge, strike from the record, or expunge the case (might be other examples). For such motions, the idea is that "evidence" would be argument(s) in support of the motion.
You're forgetting a basic mechanism relative to the fifth amendment of The Constitution of the United States of America extended via the 14th amendment to the state level: The mechanism that it's on the prosecution to prove the defendant guilty, not for defense to prove its innocence. Defense ought to be seeking to refute (deconstructing and eliminating prosecution's argument, such as through getting rid of the record itself) prosecution rather than defense seeking to make a case for its own innocence.
For defense to seek to enter evidence for itself (to supposed, as defense might think, prove-up innocence) is essentially violating the defendant's 5th amendment right, thus generating incrimination for said defendant.
For any critics of my answer, let's imagine the alleged offense was listed as stealing a recording to prove one's innocence. Think about that for a while. :)
"As an example, let's say that in a given jurisdiction you don't have the right to film someone on your property without their consent, but you have hidden cameras on your premises anyway, and then you'd like to use those recordings to defend yourself when they show you did not commit a crime you are being accused of."
In the State of Illinois, statutory law asserts that hidden cameras aren't supposed to be used, such as in a bathroom (I can't remember what ILCS: I think it's state statutory law, anyway). But a judge might get crooked and allow it in (there is a case law system in place, which contrasts with state law, albeit persons might further push the idea of what state law says meaning the judge made a mistake of law).
If a person seeks to enter those videos from the hidden camera (let's say, specifically from a bathroom), then that person (relative to state law) been deceived into thinking it was a good idea to do such. Granted, people get crooked and enter alleged evidence that ought to never have been admitted (fraud upon the court); but it still happens.
But still, there is the matter of the Fifth Amendment of the Constitution of the United States of America: Prosecution's overall center of gravity was of such a degree to keep you deceived from using it along with your overall center of gravity not being high enough to use it while seeking to refute prosecution's claim of guilt.