Oh, I dealt with this in my pregnancy and spoke to many others that had. Did the doctors call it a subchorionic hematoma? What I learned from my experience is that officially size, age of the mother, and time of gestation at diagnosis influence the outcome (whether the pregnancy will be saved or not). Unofficially from talking to people it seems that size is not always a good predictor of outcome. Obviously, the bigger it is, the more careful you'll want to be "just in case".
To the best of my knowledge there are risk factors but no specific reason, it just happens or it might happen for different reasons to different women.
Some women "bleed out" the clot and in some others it just reabsorbs. It takes a while for it to be reabsorbed so don't despair if it's still there in the next ultrasound. For some women instead of a clot they will have blood pooled near the pregnancy sac and therefore will experience bright red, abundant bleeding. My doctor back then said to limit my activities but that bedrest was not necesary. If you are worried, I'd say a little bit of bedrest never hurt anyone :) Best of luck to you.