https://www.serebii.net/games/evs.shtml
This should explain things. I'll do simple form of it.
Each pokemon gives off EV values. If you kill that Pokemon you gain those EVs. Every 4 EVs adds 1 extra stat at level 100. Max you can do is 255 (252 in PRO), and max EVs you can gain overall is 510. So if you want the fastest weavile you want to find a 31 iv speed one and ev train with 252 speed evs.
This guide might be outdated but will help find the best places to ev train what stat you need: https://pokemonrevolution.net/forum/viewtopic.php?f=124&t=3275