My son actually did an independent project on this topic back in grade 5 (he did NOT get to share it with his class

).
Basically it comes down to how much testosterone your female dog has. Some girl dogs have more, and some have less. The testosterone drives certain instinctive behaviors like marking and humping which we associate with male dogs.
Interestingly, it's not directly correlated with how dominant your dog is overall. Our dog is very submissive with everyone EXCEPT one of our cats. Our male cat is the one creature she gets to dominate. She leaves the other cats alone, and just focusses on him. He's her wubbie. She humps him and chews on him and basically loves on him. I assume it must feel pretty good, or she wouldn't keep doing it.
As for our cat... he mostly just lies there and takes it. If it gets too much, he'll jump up on the table.
Our dog must have a fair bit of testosterone for a mild-mannered little girly dog. She also sometimes hikes a leg into the air when she pees.