Quoted By:
Here's how it works: if you've got the exp share turned on, everything in your party gains EVs.
Everything that isn't already EV capped will gain a certain number of EVs depending on what you're fighting.
For example, lets say you're fighting a spinda horde- spinda gives 1 special attack EV, so everything in your party would gain 5 sp.atk EVs. In addition to any you get normally, the power items add 4 of the corresponding EV to the pokemon holding it. So if you fight a spinda horde while one pokemon is holding a power anklet and another holding a power bracer, the one holding the anklet will gain 20 speed EVs and the one holding the bracer will gain 20 attack EVs, while both of them gain 5 special attack EVs. Anything with pokerus receives twice as many EVs as normal as well.
Also, since many hordes will give EVs in stats you don't want, you've got 2 options: you can run from the ones with the wrong stats, or you can grow certain types of berries that reduce a certain EV by 10 when used. If you've already got a bunch of EVs you don't want you can use the berries for that too, or you can use a reset bag in super training or bring a kee berry and maranga berry to the juice shop to reset that pokemon's EVs completely.
You can also check the super training screen to get a rough idea of how many EVs you've earned so far in each stat