Win Shares is a statistic developed by sabermetrician and author Bill James. The statistic is meant to assess a player's value in terms of his ability to help his team win games.
To say as much as possible without taking away from the value of James' book (ISBN 1931584036), the concept of Win Shares is derived from Marginal Runs Scored and Marginal Runs Saved. The margin is defined as one half of the league average runs scored for hitters, and one and one half the league average runs allowed for pitchers.
For example: In 2004 the Chicago Cubs scored 789 runs and allowed 665 runs. The average amount of runs scored was 751 runs, the margin was 376 for hitters and 1127 for pitchers - 375.5625 and 1126.6875 to be exact. To calculate marginal runs, subtract the hitting runs margin from the amount of runs the Cubs actually scored (789-376) and subtract the total amount of runs allowed from the pitching runs margin (1127-665). This yields totals of 413 hitting runs and 462 pitching runs, which add up to 875.
Therefore, Cubs had 875 marginal runs. Dividing that amount by twice the amount of league average runs (1502) gives an expected winning percentage of 0.582, or 94 wins. Since the Cubs only won 89 games, all final totals are cut down by about 1.05%.
Figuring out how to allot marginal runs per player takes several pages and paragraphs to explain- it has a lot to do with Runs Created and some to do with sabermetric fielding analysis. It could be explained here, but that's why Mr. James sells books. That's the basics behind calculating Win Shares for a team.