>>43602925IVs and EVs are two completley different things that work similarly. EVs are earned by
>when you gain EXP from defeating a Poemon>medicines>pokejobsEvery 4 EVs a Pokemon has of 1 stat, it gains +1 point in that stat. Each stat can have a maximum of 252 EVs per stat, and 510 in total. Because 510 is not divisible by 4, you will only use 508 and have 2 leftover. If you play VGC or a lvl 50 format, there's an additional caveat with level scaling that causes stats to be reduced to whatever level you are (lvl50= 50/100= scaled 50%, lvl 70= 70/100= 70% scaling, etc) and it will only give a stat every 8 EVs unless the scaling causes a point to round down from being at X.5)
To answer your question, research what EVs a pokemon will drop, it depends on what species you fight. If you kill a Mankey, they give +1 attack EV. Primape would give +2 attack. But you fight Snorlax and it drops (I think) 2 HP EVs. Serebii can tell you, but typically (not always) it's whatever the highest stat of the Pokemon raised to the value of it's place on the evo chain. Some are outliers though, like I think Scrafty gives =1Def and +1 SpD.
rare candies have been changed for a while, currently it levels you up and gives you no EVs. You can EV train at any time, before or after leveling, EVs give stats whenever they're earned and has nothing to do with leveling.