WAR measures a player's value in all facets of the game by deciphering how many more wins he's worth than a replacement-level player at his same position (e.g., a Minor League replacement or a readily available fill-in free agent).
For example, if a shortstop and a first baseman offer the same overall production (on offense, defense and the basepaths), the shortstop will have a better WAR because his position sees a lower level of production from replacement-level players.
For position players: (The number of runs above average a player is worth in his batting, baserunning and fielding + adjustment for position + adjustment for league + the number of runs provided by a replacement-level player) / runs per win
For pitchers: Different WAR computations use either RA9 or FIP. Those numbers are adjusted for league and ballpark. Then, using league averages, it is determined how many wins a pitcher was worth based on those numbers and his innings pitched total.
Note: fWAR refers to Fangraphs' calculation of WAR. bWAR or rWAR refer to Baseball-Reference's calculation. And WARP refers to Baseball Prospectus' statistic "Wins Above Replacement Player." The calculations differ slightly -- for instance, fWAR uses FIP in determining pitcher WAR, while bWAR uses RA9. But all three stats answer the same question: How valuable is a player in comparison to replacement level?
Why it's useful
Obviously, the goal of baseball is to win games, and WAR quantifies each player's value in terms of a specific number of wins. A player with a WAR of 0 is essentially a replaceable piece, while a player with a WAR of about 8 should almost always be an MVP candidate. And because WAR factors in a positional adjustment, it is well suited for comparing players who man different defensive positions.
WAR is an all-encompassing evaluation tool, and it can help rank players across positions. But WAR also places an emphasis on defense and therefore isn't the most accurate metric by which to assess a player's fantasy performance.