IVs (Individual Values) and EVs (Effort Values) are separate. A man in the Pokémon Center in Kiloude City (post-game) will tell you whether you have perfect IVs in any given stat category. He'll say those stats "can't be beat." IVs are set from the moment a Pokémon is caught or hatched, and cannot be changed. Their a number between 0 and 31 and determine stat growth. There's an IV for each stat category. 31 is perfect and ensures highest stat growth.
While you can't change them, you can eventually pass them on via breeding. A Pokémon holding Destiny Knot while breeding will ensure five IVs across the two parents will pass onto the child. So you keep hatching until you have a child that gets the good IVs from their parents. Then you breed that with another Pokémon that has the good IVs you're still missing, using Destiny Knot again to pass on five of the parents' IVs. Eventually, you'll get the good IVs you already have plus the ones you didn't.
To get parents with some good IVs as a starting point, the Friend Safari Dittos are excellent -- they each have at least two perfect IVs. Ditto can breed with anything and produce a child of the non-Ditto parent.
EVs, meanwhile are different and can be distributed freely by the player, up to 510 EVs total. You get EVs by Super Training (hit the R button to scroll to the Super Training screen), or by battling Pokémon, each Pokémon giving a certain EV point (one or two EV points, in one of the stat categories). The most efficient way is Horde battling, using Oddish's Sweet Scent to lure out Hordes and then OHKO everyone at once with moves like Surf or Earthquake. The trainee will receive the full EVs via Exp. Share. Equipping the trainee with a Power Item for the stat being raised increases the EVs received by 4 per Pokemon. Having the Pokerus condition ("infected" by putting the Pokémon next to a Pokémon with Pokerus) doubles the EVs received.
For every four EVs in a stat category, that Pokémon gains an extra point in that stat at lv. 100. Super Training stops you at 252 EVs per stat category, since 252 is divisible by 4 and there's no benefit beyond 252. Thus, if you keep doing the Attack minigame in Super Training until it says your Attack is maxed out, or if you keep doing Horde battles for Attack points until your Super Training graph says the same, your Pokémon will have an Attack stat about 63 points higher at lv. 100.
Since 510 total is the limit, and 252 is the most per stat category (where benefit is concerned), most people invest 252 in one category and 252 in another (by training in Super Training until it stops adding points in that category). Then the extra 6 points go in a third category, to add one extra point at lv. 100. Yeah, that means two EVs always go wasted.
You do this in conjunction with nature. Each nature (except the neutral ones) will make one stat grow more, and one stat grow less. So usually you look for a Pokémon with the nature that grows the stat you plan to use a lot. If I'm raising a Pokémon that will only use Special Attacks, but never use Physical Attacks, I'd use a Modest Pokémon (+ Sp. Attack, - Attack). Then I'd invest EVs into his Sp. Attack, most likely, to get the most power out of it.