Effort Values (often abbrieviated to EVs and for a time were called Stat Exp) are 'points' that are given to a Stat in order to raise its overall value when certain Pokémon are beaten. These extra points that are added onto a certain stat are culminated and added on at various points throughout levelling up, with their true value being expressed only at Level 100. Pokémon that are raised with a Rare Candy don't gain these points as no Pokémon are battled, and since all Pokémon distribute a certain EV Yield, a Pokémon becomes stronger thruough battling any Wild or Trained Pokémon. This distribution is why Pokémon that have been raised by a trainer are more powerful than those found in the wild.
Generally speaking, beating a fast Pokémon will give more of an increase in the Speed stat than that of a slow Pokémon, beating a Pokémon with a high amount of Hit Points will give an increase in the amount of HP gained upon levelling than a Pokémon with a low amount of hit points, and continues for all other statistical value. For example, if the player were to fight 100 Starly, their speed would be increased at a faster rate than if they battled 100 Machop. This is because Starly distribute 1 Speed EV when defeated while Machop distributes 1 Attack EV when defeated, contributing to seperate stats. In Generation I and Generation II the EV yield given by the Pokémon were equal to their base stats.
Gaining Effort Values can be considered either simple or complicated depending of whether or not you want to max out the Stat (A maximum of 252 EVs per stat, 510 globally), and for mazing out all Effort Values will result in receiving an Effort Ribbon.
 Generation I
Although the EV system was introduced in Generation I, it went under the name of Stat Experience or Stat Exp for short.
The Pokémon data structure contains 2 bytes for each of the five stat, that starts at 0 and has a maximum of 655235 for each stat (note that EV yield was based on the base stats). As the Pokémon was defeated, it's base stats were added to the Stat Exp total after being converted into EVs. If 100 Mew were to be beaten, it would max the EVs stat. Even at level 100, a Pokémon can continue to become stronger through the use of EVs until it has reached the maximum os 655235. The renown box trick factors the EVs in.
EVs are factored into a Pokémons' statistics as it levels up and, additionally, are calculated when a Pokémon is removed from Bill's PC - known as the box trick. Pokémon that reach level 100 and need need to max out the 655235 can use the box trick to factor them in.
Vitamins add 2560 to whichever stat that it is given to but cannot be raised above 25600 (10 Vitamins, a limit which still exists in current Generations). Exp. All, unlike the Exp. Share didn't share out the EVs when distributed by a fallen Pokémon.
At level 100, the formula for calculating the difference between a Pokémon that has been trained to one that hasn't is the following:
√STAT EXP / 4
 Generation II
Effort Values still hold the same premise in Generation II as they did in Generation I. Special Attack and Special Defense are still capped under the Specials section of the Stats in order to maintain compatibility and the box trick method can still be used.
Pokérus was introduced in this generation - a status ailment that doubles EVs gained.
 Generation III
The entire effort value system is overhauled in this generation. Rather than Pokémon distributing EV yields depending on their base stats, they now give out either 1, 2, or 3 Effort Values when the Pokémon is beaten (each Pokémon was allocated a certain amount they can distribute). In battles that do not give out any Experience (E.G. Battle Tower), EVs were not gained. When a Pokémon reaches Level 100, they will gain an increase of +1 in a stat for every four effort values they gained. For those that have gained points through battling, they will be calculated upon levelling up, with the exception of Deoxys in which it was calculated after every battle.
Pokémon are now limited to only obtaining 255 EVs per stat with 510 EVS being acheiavable statistically universally. However since a stat only increases by 1 at level 100 for every 4 EVs gained, the most possible for a stat is 252.
Vitamins now give 10 EV points for every one used, yet still retain the 10 Vitamin limit as in previous games, meaning the maximum amount of EVs capable of being given by Vitamins is 100 for a stat. The new Vitamin Zinc was added to raise the new stat, Special Defense.
If a Pokémon is holding a Exp. Share and is not in battle they will also receive EVs even if the Pokémon in battle has maxed out their EV stats. If the Pokémon also has Pokérus, these EVs are doubled.
Macho Brace, a new item, also doubles the amount of Effort Points gained in a battle. When used alongside Pokérus, the Pokémon can receive x4 the usual amount of EVs given off by a Pokémon. For example, you'd only have to battle 1 Patrat in order to gain 4 EVs in Attack. The effects of this item however, do not transfer over via the Exp. Share.
As of Pokémon Emerald, certain Berries that could previously be used to make Pokéblocks can decrease the EVs of a stat by up to 10 (Provided that there are EVs on that certain stat). These also increase the Happiness of a Pokémon. These berries are:
 Generation IV
Many of the mechanics remain the same in Generation IV as they did in Generation III, however, EV Reducing berries (Listed above) will reduce a stat by a maximum of 100 if the stat if trained above 100.
New Items have been added that increase the amount of EVs gained from defeating a Pokémon. These boosts are also effected by Pokérus however the effects are not transferred via the use of the Exp. Share.
If a Pokémon has an alternate form that changes some of it stats, for example, Giratina, any effort values that had be gathered will be transferred over the stat that has been changed. This is an example of a Pokémon's stats increasing without it needing to level up. An example would be that, when Darmanitan transforms into it's Zen Mode, if it had bee EV Trained in the Attack stat, those EVs will be transfered over to it's Special Attack mode (Note: This is a Gen V Pokémon so it won't work in Generation IV, it was used for the sake of example).
 Generation V
The EV mechanics remains much the same as it has in Generation IV and Generation III. EV-Reducing berries, (which are only found in the Dream World) no longer reduce the EVs of a stat by 100 if it exceeds that number and now only deducts them by 10 at a time. Pokémon can now be EV trained even at Level 100 and stats are recalculated after every battle, this means this is no longer exclusive to Deoxys in Generation III.
Wings are now introduced that increase the EV of a stat (depending on the Wing used) by 1. Unlike the Vitamins before them - which still exist in Generation V - Wings are not restricted by the 100 EV limit and can now max out at 255 (or 510 spread over all stats). In total there are 7 wings, however only 6 wings increase a specific stat. The Pretty Wing does nothing. These wings can only be collected from Dark Patches that appear at Driftviel Drawbridge (next to Driftviel City) and Marvelous Bridge. (near Route 15 and Route 16)
Related ThreadsEffort Value Training Guide - last post by @ Oct 3, 2004
Effort Value help - last post by @ Jul 7, 2011
Effort Values.... - last post by @ Sep 1, 2007
effort value of modified wild pokemon - last post by @ Jun 28, 2013
effort values and web sight. - last post by @ Feb 14, 2007