A tower shield typically grants a Medium wielder total cover against melee attacks launched by Medium foes from the square opposite the shield and from similar foes' melee attacks launched from the squares to the left and right of the square opposite the shield…
The tower shield says
As a standard action, however, you can use a tower shield to grant you total cover until the beginning of your next turn. When using a tower shield in this way, you must choose one edge of your space. That edge is treated as a solid wall for attacks targeting you only. You gain total cover for attacks that pass through this edge and no cover for attacks that do not pass through this edge.
Then Cover says
When making a melee attack against an adjacent target, your target has cover if any line from any corner of your square to the target's square goes through a wall (including a low wall). When making a melee attack against a target that isn't adjacent to you (such as with a reach weapon), use the rules for determining cover from ranged attacks.
So to determine if the defender has cover from them, the Medium foes armed with longswords occupying the left and right squares opposite the tower shield must draw a line from the least advantageous corners of their squares to the most advantageous corner of the defender's square, and such a line will go through the tower shield, giving the defender total cover.
…But for foes making ranged attacks and using reach, it's a little different
Cover also says
To determine whether your target has cover from your ranged attack, choose a corner of your square. If any line from this corner to any corner of the target's square passes through a square or border that blocks line of effect or provides cover, or through a square occupied by a creature, the target has cover (+4 to AC).
Thus, if attackers are employing ranged weapons or attacking with reach, to determine if the defender has cover from their attacks, the attackers, instead, pick the line to be drawn from their most advantageous corners to the defender's most advantageous corner.
While this still leaves the defender with total cover from attacks by the typical Medium attacker on the shield's opposite side, it's unclear if adjacent foes to the left and right of that attacker that are armed with ranged weapons are likewise impaired. The typical Medium creatures to the left and right of the shield opposite side can pick a corner that causes the traced line to skirt the tower shield's border, which would normally be sufficient to grant the defender cover (therefore total cover via the tower shield), but it's only from attacks that pass through the tower shield's edge against which the defender gains total cover, and whether this is through enough is a question for the GM. Ask the GM if it's possible for a dude with a crossbow to run up to the diagonal edge of your tower shield and cap you with a crossbow by, essentially, shooting around the tower shield. If the GM rules it is possible, admire such a foe's bravery before gutting him.