OK, so to begin with, there are two different—related, but separate—things called “two-weapon fighting.” There is two-weapon fighting, a combat option available to anyone, and the Two-Weapon Fighting feat, which improves your usage of the two-weapon fighting combat option. No, this naming scheme was not well-considered.
The two-weapon fighting combat option is something you can choose to use when you make a full-attack, that is, spend a full-round action making all of your attacks. If you do not full-attack—for example, if you use the standard action attack—you cannot choose to use two-weapon fighting, and you only ever get one attack.1 Full-attacks in general are required for all manner of multiple-attack situations—whether the extra attacks come from high BAB, a haste spell, two-weapon fighting, whatever. Full-attacking is the way to get those extra attacks.
When you choose to use the two-weapon fighting combat option, you take a penalty to all attacks during that full-attack. You also designate one hand as your “main hand,” and all other hands are “offhand.” If your offhand weapon (or weapons, if you have three or more hands) are all light weapons, you take the lowest penalty; if any of them are not light, you take a larger penalty.
The Two-Weapon Fighting feat simply lowers the penalties you take when using the two-weapon fighting combat option.
Ultimately, the two-weapon fighting combat option is only worthwhile if you have the Two-Weapon Fighting feat, and are using a light weapon in your offhand. The penalties you take otherwise are just too large to be worth it, and so I am only going to offer calculations for this situation. With all offhand weapons light, and the Two-Weapon Fighting feat, the penalty you take on all attacks in the full-attack is −2.
So, OK, an example then: 3rd-level rogue, so BAB +2, and Dexterity 16, for a +3 bonus. Assume feats are Two-Weapon Fighting, Weapon Finesse, and Weapon Focus (short sword), and you’re wielding a pair of short swords.
Your normal attacks are made at
$$BAB + Dex + WF_\text{short sword} = +2 + 3 + 1 = +6.$$
When you choose to use the two-weapon fighting combat option, that becomes
$$BAB + Dex + WF_\text{short sword} + P_\text{two-weapon fighting},$$
where \$P_\text{two-weapon fighting}\$ is your penalty for using two-weapon fighting: −2 with a light weapon (short sword) in the offhand and the Two-Weapon Fighting feat. So
$$BAB + Dex + WF_\text{short sword} + P_\text{two-weapon fighting} = +2 + 3 + 1 - 2 = +4$$
Therefore, your options are to attack once, at +6, or (assuming a full-attack) to attack twice, at +4 for both attacks. That is, yes, all of these bonuses apply to both attacks.
That is not necessarily always the case. Suppose instead you used a rapier and a short sword, instead of a pair of short swords. Weapon Focus (short sword) would not apply to the rapier, so when you use two-weapon fighting, you would attack at +3 with the rapier and then +4 with the short sword.
You didn’t ask, but note that the −2 penalty only applies during that full-attack. As soon as it is over, the penalty goes away. For example, if you were to full-attack someone, attacking twice at +4, and then, on their turn, they move away from you and trigger an attack of opportunity, that attack of opportunity would be at +6, not +4, because the −2 penalty from two-weapon fighting has gone away.
Also, bear in mind that using two-weapon fighting is always a choice—you can choose not to use it, and not get the extra attack, in order to avoid the −2 penalty. Not usually worth it, but the option is there. Simply carrying a second weapon doesn’t make using two-weapon fighting compulsory. In fact, you can even use both weapons in one full-attack without two-weapon fighting, if you have multiple attacks for other reasons. You only use two-weapon fighting, and only take the penalty, when you get the extra attacks.
Finally, some important pieces of information to know:
- Except sometimes you do get more, e.g. with the Cleave feat or the Snap Kick feat from Tome of Battle. Point is, relatively few options allow more than one attack as a standard action—you usually need a full-attack to get more than one attack.