Sometimes it's clear.

I failed the test because I didn't study. (no comma)

But sometimes it just seems like such a guessing game. I have longer sentences that the meaning isn't all that clear and I'm uncertain as to whether to use a comma or not.

Anybody got any ballpark-rule on this?