How do IV stats work?

IV stands for Individual Value.

IVs are a hidden stat that every Pokemon has innately, that cannot be changed after the Pokemon is originally generated. Each Pokemon has six separate IVs, one for each basic stat (Attack, Defense, Special Attack, Special Defense, Speed, and HP). The IV values can range from 0 to 31, with 31 being the best.

The specific equations to calculate stats at a given level include IVs, but it's a pretty complicated ordeal.

Here's the equation for HP:

enter image description here

And the equation for all the other stats:

enter image description here

(Images courtesy of Bulbapedia)

IVs are hidden values, and there is no way to tell them without simply noting your stats and EVs at several different levels and reverse-engineering them using a calculator. A good calculator for this task can be found here.

The best way to test for IVs upon newly hatching or catching a Pokemon is to save the game, then feed it a bunch of Rare Candies while noting its stats each level. After you narrow down its IVs, load the game again. The IVs won't be changed, but you'll have your Rare Candies back to use again.

You can also attempt to breed a Pokemon with the same IV stat as its parent by using a specific EV breeding item. Trust me, trying to get the IVs you want takes forever.