If you click the little icon above the menu in the lower right corner (it's supposed to look like a 20-sided die, but doesn't really), you'll get a log of the combat. Click on the blue text where it says "[your character name] misses" and it'll give you a breakdown of the roll, your total modifiers, and the target number (the enemy's AC) you need to hit. Sometimes you just roll crappy. Sometimes it's because you're not realizing you're being penalized for something like cover or the oft-forgot "firing into a melee" penalty. The rules of D&D are followed pretty closely here, so there's nothing too mysterious, but the rules are a tad on the detailed side at times. Here's a good link to the relevant rules:
The Hypertext d20 SRD (v3.5 d20 System Reference Document) :: d20srd.org
As for hitting, here's some basics:
1. Each PC has a "base attack bonus" based on their class levels. Fighters and such get +1 each level. Wizards get +1 every second level. This number gets added to your total to-hit bonus for your attack roll.
2. If you're fighting with a melee weapon you generally (with a couple exceptions - weapon finesse) add your strength modifier to your to-hit bonus as well.
3. Magic weapons add to the bonus for each enhancement point they have.
4. Some feats can increase your to-hit (e.g., weapon focus for the weapon you're using).
5. Total all the various bonuses together and this to-hit bonus is added to a single roll of a 20-sided die. If you meet or exceed the target's armor class, you hit.
6. The target's AC is sometime increased by feats, cover, etc.
7. You sometimes suffer penalties for status ailments, web entanglement, etc.
8. Sometimes you miss because the opponent has concealment due to darkness, blindness, etc. (This is a straight up % chance to miss no matter what your bonuses are.
Take a look at your roll breakdowns and see what's hurting you. It might be something like you're using a weapon you're not proficient with (a -4 penalty to your to-hit roll)
9. Ranged weapons like bows are somewhat different. You use dex instead of str to modify your to-hit.
10. If anything gets between you and the target, he'll get a +4 bonus to his AC (making the number you need 4 higher).
11. If he can reach one of your guys (or they can reach him) with an attack (see the yellow circles), you'll take a -4 firing into melee penalty unless you get the precise shot feat.
12. If you're wondering what the difference is between him getting +4 to AC and you taking -4 to-hit, effectively there isn't one, so don't worry about it. Just helps conceptually keep things straight.
I hope that helps. Let us know if you have more ?s.
