I'll start by covering the second question, since it is the simpler one to answer. In D&D 3.5 there is no concept of "targeting" or facing in the sense that you are describing. If an enemy is in combat with PC 1 and PC 2 it can be assumed that the enemy is putting forth equal effort towards fighting each. As for taking penalties to melee attacks, no you do not. In fact, based on the positions of the PCs they may get a bonus from flanking.
Now on the topic of your first question, attacks of opportunity are most commonly caused by one of two things, either moving out of a threatened space or performing a distracting act while in a threatened square. Let me define these, as stated on the SRD
You threaten all squares into which you can make a melee attack, even when it is not your action. Generally, that means everything in all squares adjacent to your space (including diagonally). An enemy that takes certain actions while in a threatened square provokes an attack of opportunity from you. If you’re unarmed, you don’t normally threaten any squares and thus can’t make attacks of opportunity.
Moving out of a threatened square usually provokes an attack of opportunity from the threatening opponent. There are two common methods of avoiding such an attack—the 5-foot step and the withdraw action.
Performing a Distracting Act
Some actions, when performed in a threatened square, provoke attacks of opportunity as you divert your attention from the battle. Actions in Combat notes many of the actions that provoke attacks of opportunity.
so in the situation that you described above, being a PC moved away from an enemy, that would provoke an attack of opportunity assuming the following:
- The PC started in a square the enemy threatened
- The enemy had a weapon to attack with, which can include a natural weapon
- The PC didn't do something to avoid the attack, such as a 5-foot-step, tumble check, or full withdraw action.
As for the attack being defined as free, that does not mean it automatically hits. The attack must still be rolled, applying all applicable modifiers, and any character/monster may only make a single attack of opportunity per turn. So free really means outside of the typical action economy of one standard and one move action per turn.
I hope I answered everything clearly for you, feel free to comment if you want me to explain anything in more detail. In addition I would highly recommend reading the SRD, which I linked above, to learn more about Attacks of Opportunity.