If Individual Values represent a Pokemon's natural talent, Effort Values (or EVs for short) reflect the hard work and training put in by the Pokemon.
In a similar manner to IVs, each Pokemon has an EV in each of the six key stats: HP, Attack, Defense, Special Attack, Special Defense and Speed. To begin with, EVs are set to 0 in all stats (although there are exceptions).
As your Pokemon battles and defeats other Pokemon, that Pokemon will steadily gain EVs depending on the species of Pokemon defeated. Weak Pokemon generally award 1 EV in a given stat, while stronger ones can award 2 or even 3 EVs.
EVs can be gained at any time, even if a Pokemon is Level 100. However, EVs cannot be endlessly gained. Pokemon can gain a maximum of 252 EVs in a single stat and, on top of that, each Pokemon is restricted to a total of 510 EVs spread between all stats.
The EV Advantage
While a Pokemon's IVs are predominantly fixed, it should be clear that EVs can be customised. Although, as with IVs, you don't need to concern yourself with EVs during the main story, as their influence is hardly felt. Only for tougher battles, should you start to consider planning.
At Level 100, a Pokemon gains 1 stat point for every 4 EVs accumulated (while at lower levels, the gain is proportionally smaller). Since a Pokemon can gain up to 252 EVs in one stat, that equates to a (you can do the Maths) 63 maximum stat boost in a single stat.
Before, we said a difference of 31 stat points was a big deal, so this is a big, BIG deal. Not to mention you're allowed 510 total EVs, so you can have a second stat boosted by 63 points and a third stat boosted by 1 point (which is tiny, but better than nothing).
Needless to say, comparing a run-of-the-mill Pokemon taken from the main story with a random Nature and IVs and unoptimised EVs with a hardcore trainer's Pokemon with a carefully selected Nature, the best IVs and optimised EVs is like looking at night and day!
Alright, so we've hopefully sold you on EVs, but how exactly do you customise your Pokemon's EVs? Is it even possible to optimise their EVs? Well, of course, otherwise we wouldn't be here!
The primary method of EV training--the term coined for training your Pokemon in such a way to promote specific EV gain--is very simple: via good ol' battling, with wild Pokemon no less.
As mentioned, each Pokemon species awards 1 to 3 EVs in a given stat. Therefore, all you need to do is identify which species gives what EVs, then focus on defeating that species.
By the way, EV training is best done after the main story. During the story, you'll be encountering a wide range of Pokemon, each with wildly different EV yield, making careful EV management simply unfeasible.
Outside of battles, you can feed your Pokemon vitamin type items such as Calcium and Carbos, which boosts EVs by a healthy 10 points in the specified stat. Trouble is vitamins are expensive and you cannot use vitamins if the EVs in a stat are 100 or more.
Wing type items such as Genius Wing are not bound by such restrictions, but they boost EVs by 1 point each, which is a paltry amount.
Moving onto newer methods, Isle Evelup in Poke Pelago allows you to passively EV train up to 3 groups of 6 Pokemon while you go about other business or take a break from the game.
Finally, you can use Festival Coins to buy drinks for your Pokemon in the Festival Plaza that instantly maximise the EVs in one stat. However you can only enjoy this luxury once per day.
Oops, I Messed Up...
It happens to us all. Occasionally, you may fudge the Maths slightly or do something that causes you to gain the wrong amount or type of EVs. All is not lost though, as there are certain berries that claim to "lower" a particular stat, which actually has the effect of reducing EVs in that stat by 10 points.
These berries can be gotten from the berry tree halfway along Route 10. Afterwards, you can grow these berries in large numbers on Poke Pelago's Isle Aplenny. You know, just in case...
EVs the EZ Way
With 510 EVs to gain for each Pokemon, you've got your work cut out for you. Fortunately, there are ways to speed up EV gain.
Firstly, you can give your Pokemon certain hold items that promote EV gain. The Macho Brace has disappeared unfortunately, but for 16 BP each at the Battle Royale Dome you can purchase Power items, such as the Power Anklet. These will add a flat +8 EVs of the stat they correspond to.
In addition, Pokemon that have contracted Pokerus will permanently earn double EVs, even after Pokerus is cured. You have a lottery-chance of contracting Pokerus from wild Pokemon, but thanks to the advent of Wonder Trade, it's not uncommon for infected Pokemon to be sent en masse. So give Wonder Trade a try!
The best thing is that Power items and Pokerus stack. So if you fight a Pokemon that gives +1 EV to Speed with a Power Anklet equipped and the Pokemon has Pokerus, you will get (1 + 8) * 2 = 18 Speed EVs. Wow!
Additionally, if you're EV training multiple Pokemon, you can turn on EXP Share, which shares out the same amount of EVs to your entire party. Whoa! Just make sure every Pokemon in the party is either already maxed out or needs the EV of that particular stat.
Finally, although Pokemon Sun and Moon removed horde battles (the best method of EV training back then), you can use ally chaining for a similar effect. When a wild Pokemon is low on health, it may call for an ally to help it. You can use the Adrenaline Orb item to encourage this behaviour as well.
How ally chaining works is that after a Pokemon calls for an ally, you defeat the original Pokemon or the ally Pokemon--ideally the latter--and then wait for the remaining Pokemon to call for another ally. Afterwards, repeat the process, to spawn more and more allies.
Each ally Pokemon summoned grants double the usual EVs--and the best part is that this effect stacks with Pokerus and the Power items. So with each ally Pokemon defeated, you can gain (1 + 8) * 2 * 2 = 36 EVs. So to reach 252 EVs, you need only defeat 7 ally Pokemon. Not bad, not bad!
Other Benefits of Chaining
Furthermore, as the "chain" of allies increases, the better the chances of finding Pokemon with high IVs, a rare Hidden Ability or even Shiny Pokemon!
To stop the chain from spiralling out of control, use a move that immobilises the wild Pokemon. In particular, Thunder Wave is perfect for non-Electric wild Pokemon, while moves like Hypnosis or Sleep Powder are effective against most Pokemon.