This cheat sheet breaks spellcasting down for you very well:
http://pavao.org/shadowrun/cheatsheets/SR4Spellcasting.pdf
With your example of a force 6 powerbolt, the caster would roll magic + spellcasting (and any other bonuses like a spellcasting focus). We'll say the player has 6 in all stats/skills to make it easy, and no focus, so the caster will roll 12 dice. We'll say he scores 4 hits. If he had scored more than 6, only 6 of those hits would count, because they are limited by the force of the spell.
Tthe defender would now roll his body (for physical spells, willpower for mana spells) and counterspelling (if he has it, or if a mage had previously declared that he is using counterspelling on the defender). We'll say the defender has a willpower of 4 and a nearby mage is using counterspelling on him (the mage has a counterspelling skill of 3). The defender rolls 7 dice, 4 for his willpower, and 3 for the mage's counterspelling skill. We'll say he gets 2 hits, reducing the caster's hits to 2. The final damage of the spell is 8 (Force 6 + 2 net hits). If the defender had rolled 4 or more hits, it would have reduced the caster's net hits to zero, and the spell would have no effect on the defender.
There's also a nice example on p. 184 of the SR4A book.
For counterspelling combat spells, I'm fairly certain that the counterspelling skill level is simply added to the resistance dice pool.