Most state laws on stoplights read something like this:
A driver facing a steady circular red signal shall stop (1) at a marked limit line, or (2) if none, before entering the crosswalk on the near side of the intersection or, (3) if none, then before entering the intersection.
The legal elements of this offense are basically the same as for driving through a stop sign, with one big exception. Stop signs stay red all the time, but traffic lights change colors. Of course, it's always legal to drive safely through an intersection when the light is green or yellow. In fact, in most states, as long as the front of your vehicle entered the intersection (passed the crosswalk or limit line) before the light turned red, you haven't broken the stoplight law.
Here are the most successful defenses.
Your View Was Better Than the Officer's
The only time an officer has a really good view of when your car entered an inter section is when he or she is sitting directly to the side of, and close to, the intersection (usually either standing on the corner or in a car on the cross street near the corner). But chances are the cop was someplace else—sitting across the street in a parking lot, perhaps.
Cross-examine the officer as to exactly where he or she was when he or she says you ran the red light. Ask the officer whether other cars were in a position to obscure the view of the intersection. (See this article for more on cross-examination.) Then, when it's your turn to testify, provide detailed testimony, making it clear where you were when you saw the light turn yellow, and how far you were across the inter section when it turned red. Make a simple diagram like the one below (adapted for your particular situation, of course) and show it to the judge. And especially if the cop really did see you from a bad angle, work in the wide receiver analogy—it's a real winner with jock judges.
Bring a witness to court. When a judgment call is involved (such as the location of your front bumper when a light turned red), two observers are always far better than one. If someone who was riding in your front seat can testify that the light was still yellow when you entered the intersection, you should present that person as a witness.
The Officer Didn't See Your Red Light
When a light turns green, we assume the light for cross-traffic has simultaneously turned red. For example, if an officer approaches an intersection with a green light and sees you drive across the inter section, the officer will assume you ran a red light and won't later check to be sure that the light changes were synchronized. Sometimes they aren't. If you can go back to the scene and document that the light was mistimed, you should be entitled to acquittal. And don't dismiss this possibility—neither machines nor the people who time them are infallible.
Never claim a yellow light was too short. Traffic engineering practices require the duration of yellow lights to be at least the time it takes to stop if driving at the speed limit. This might tempt you to tell the police officer who stops you or the judge at trial that the yellow light was too short ("fewer than three seconds, Your Honor"). The problem with this defense is you come very close to admitting that you were driving too fast to stop in time, or entered the intersection when the light was red. No joy there.