First, two things: This belongs in the Diamond/Pearl forums. Second, if you've ever got a pogeymanz related question, throw it in this thread.
Anywho, onto the explanation!
I'll start with IVs. IVs, or individual values, are "hidden" stat numbers that every pokemon you own or encounter, has. There is one IV number, between 0 and 31, for each of the pokemon's stats. Put simply, the higher the IV number, the higher that stat will be. If you have a 0 IV, that stat gains no boost. Have a 31 IV, over time, that stat'l gain 31 extra points total. This applies to everything in between. IVs are pretty simple, right?
Now, if you want to know how to influence what IVs your pokemon get/are just plain curious, you can read the below. If not, skip down to the bolded "EV Explanation" part of the post. =P
IVs are generated for each stat the very instant you see the pokemon in the wild (before you catch them), battle an in-game trainer's pokemon, or obtain (not hatch!) an egg. For the first two options, IVs will be completely random, and usually, you'll end up with IVs on the lower end of the spectrum. But when it comes to breeding...
When you breed two pokemon, obviously a male and a female, the egg they make can "inherit" some of the IVs either of the parent has. Up to 3 IVs will be randomly taken from the parents, and passed down to the egg, replacing the IVs that the egg would normally have, whether these inherited IVs will be higher or lower. For raw specifics, the first IV that can be inherited is completely random, the second IV will be any stat's IV but HP, and the last one inherited will be any IV but HP or Defense.
Basically, breeding is the most reliable method for getting a pokemon with good IVs. It certainly takes a long time, especially at the beginning, and a decent amount of practice, but when you need to achieve near-perfect IVs for competitive battle pokemon, it's worth it. ... Or atleast, worth it if you enjoy battling as much as I do, lol.
As you already know, 4 EVs to the corresponding stat (4 speed EVs, 4 HP EVs, etc.) will increase that pokemon's specific stat by 1. Simple, yeah? Obtaining EVs is just as simple as getting EXP too; when you defeat a pokemon, wild or in-game trainer (wi-fi or colosseum battles with friends don't count, sadly), you'll get EVs. Again, simple.
Ofcourse, getting EVs is more simple than getting the right ones. How do you get the right EVs? Knowing where each EV comes from.
All pokemon have a certain EV assigned to them, that they give to the opponent when they're defeated in a battle. For example, whenever you beat a Zubat in battle, the pokemon that were in the battle will always get ONE speed EV. Or when you beat a Whismur, you'll always get one HP EV.
So yeah, all pokemon have an EV assigned to them. But there's a bit more to that; pokemon that are evolved, or in general are stronger than your average Caterpie will give more than one EV. As we used in our last example, Zubat gives up one speed EV when it's defeated. However, it's evolved form, Golbat, gives you TWO speed EVs when it's KO'd. And in fashion to follow, Crobat, the final form of the two, gives you three speed EVs. The general rule is the higher the pokemon is on the evolution chain, the more EVs it gives. If the pokemon has only one form, the stronger it is, the more EVs.
There's another twist to EVs a pokemon give when KO'd, however. Some pokemon don't give EVs to just one stat. For example, when you KO a Muk, it gives you one HP EV, as well as one Attack EV. There are plenty of pokemon that give you "branched EVs", as I'd call them, Muk being one of them.
By now I'm sure you're wondering how to find out what pokemon gives what EVs. As usual, Serebii has the answer!
That page gives you links at the bottom that'l show you what pokemon gives what EVs, as well as how many. Just click whatever stat button you want, and the new page it loads'l give you the details. If a pokemon gives more than one kind of EV, it'l have a * (an asterisk) after it lists the amount of points the pokemon gives. Serebii's EV Dex is handy, no doubt.
There's only a few more facts about EVs worth mentioning. The first, is that unless you're hacking the game, a pokemon can ONLY have 510 EVs total, every stat's EVs totalled up. Once your EV total reaches 510, you'll gain no more. If you're curious whether your pokemon has maxed their EVs, go to the Sunyshore City market and talk to the woman on the left. If your EVs are maxed out for the pokemon in the front of your party, it'l get a ribbon. If the EVs of that pokemon are 509 or lower, you'll get... well, nothing, lol.
Secondly, no stat can have more than 255 EVs total. If for example you max your EVs for a pokemon's attack stat, and receive any more attack EVs, those EVs are simply ignored. Also, since every FOUR EVs increase your stats by one, 252 is the maximum number of EVs that actually does something for your stat. 253-255 EVs doesn't increase your stat any more than 252 EVs would.
Third, the vitamins you can buy in your game's main department store (Celadon, Veilstone, etc.), give you EVs for a specific stat, ten EVs to be exact. Yes, they're expensive, but if you've got a crapton of poke dollars to spend and you feel lazy, it doesn't hurt. =P
There're some rules about the vitamins, though. You can only give your pokemon 10 of the same vitamin total. Why is this, you ask? If your pokemon's EV for the stat the vitamin increases is at 100 or higher, you can't feed them that vitamin. So basically, if your Magikarp's HP EVs are at 100 or more, you can't give it an HP Up vitamin from then on. So keep that in mind; you can only give a pokemon 10 of the same vitamin, and you can't feed it a single vitamin if it's EVs are already 100 or more for that stat.
And ofcourse, just for the sake of listing it, the vitamins will give you these EVs:
HP Up: HP, obviously
Calcium: Special Attack
Zinc: Special Defense
ALSO, since a lot of people tend to forget, always remember the 510 EV limit. Since every vitamin is worth 10 EVs, and you can only give vitamins up until you reach 100 EVs per stat (which would be, ofcourse, 10 vitamins), this means you can only give your pokemon 51 vitamins total. Ten vitamins for five stats, and one vitamin left over for the last stat.
If you ever competitive battle, I don't recommend overdosing your pokemon on 51 vitamins, though. =P If you don't competitive battle and don't care why, no need to ask.
Fourth, any pokemon that is sent into the battle, whether it attacks or not, will receive the EVs of the pokemon it gets experience from. This includes when a pokemon gets EXP from an EXP. Share. Best of all, even though EXP. share cuts down the amount of experience you get, you still get ALL the normal EVs from the pokemon that was KO'd. So if a pokemon holding an EXP. share doesn't go into battle, but gets EXP. from defeating a Golbat, you'll still get two speed EVs from said Golbat.
FINALLY, there are certain ways to increase the amount of EVs you'd normally earn, all but one of which are item-oriented. I'll start with the item, Macho Brace.
Back when I played Ruby, and got the Macho Brace, I thought it'd be cool, makes my pokemon grow faster. But when I put it on, I saw no EXP. increase, no faster level ups, and my pokemon only got slower. I was "wtf!"ing at that point. But a year later, I realized the Macho Brace effects the EVs you get in battle.
When a pokemon holding the Macho Brace gets EVs through battling (no, it doesn't work on vitamins... I wish, lol), those EVs are doubled. So if you got a defense EV, the Macho Brace makes that two EVs. If you got three defense EVs, the macho brace makes that a whopping six. Great item, right? But the epicness doesn't end there.
There are better items then the Macho Brace. In Diamond/Pearl, the Power items were introduced. There are six total, one corresponding to each stat. They are as listed here:
Power Weight: HP
Power Bracer: Attack
Power Belt: Defense
Power Lens: Sp. Atk
Power Band: Sp. Def
Power Anklet: Speed
Since these items work for a specific stat, they don't double anything. Rather, whenever you defeat a pokemon, these items will give you +4 EVs for their corresponding stat, no matter what EVs you receive from the battle. So, if you kill a Zubat while holding a Power Belt, you'll receive one Speed EV from the Zubat, and four Defense EVs from the Power Belt.
These EVs are cummulative, too. If you KO a Geodude, which gives you one defense EV, and the pokemon is wearing the Power Belt, you'll get one defense EV from the Geodude, and four more from the Power Belt, totalling five. Great items, yeah? So, rather than KO four weak pokemon for an extra stat point, all you need to do is wear one of the Power items, and KO anything, and you've got an extra stat point for whatever item you're wearing.
However, as I described earlier, there's one method for increasing EVs that isn't item-related. It's known as "Pokerus", which is short for Poke Virus. Random wild pokemon will be infected with Pokerus, and when you defeat them, your pokemon will get said infection. Any pokemon with pokerus will have a purple notice on it's summary screen. If you want to confirm that it has pokerus, have the pokemon in your party, and heal your pokemon. The nurse should tell you your pokemon is infected.
Now that you know how to get Pokerus, I'll explain it's effects; they're very simple. Any EVs you earn in battle, whether you get them from KO'ing a pokemon, or they're doubled from the Macho Brace, or you even got them from a power item, will be doubled. It's basically a Macho Brace without taking up a hold item slot. Better yet, it stacks on Macho Brace. So, if you get 4 EVs from a Power item, Pokerus turns that to 8. If you double 3 EVs to 6 if you're holding a Macho Brace, Pokerus turns that into an amazing 12 EVs.
Ofcourse, such a great condition has it's rules. First of all, it's INCREDIBLY rare to find a wild pokemon with it, you won't find it if you go looking for it. Secondly, when a pokemon has pokerus, it can be passed to other pokemon in your party simply by battling with the pokerus pokemon a few times. Third, while a pokemon with pokerus will always be infected, once the game turns midnight, any pokemon in your party with pokerus becomes "cured", meaning that even though it still gets double EVs, it can't transfer the virus to other pokemon.
So, if by some chance you get pokerus (or someone trades you a pokemon with it), make sure you ALWAYS have a backup pokemon with pokerus in your box, since pokemon are only "cured" if they're in your PARTY at midnight.
... Well, I think that's everything. Ya, a lot to read, probably not to entertaining either. Hope that answers your question, though. If you've got any other questions, I'll be happy to answer them; preferrably in the FAQ thread, though. >.>
And if nobody here can make heads or tails of your questions about EVs/IVs, you can always google "pokemon IV/EV guide". Worked for me back in the day, just took a few mintues to find a good guide.