Maximizing stats isn't always possible, as obtaining the perfect Individual Values (IVs) to accomplish this, isn't the easiest thing to do. However, you can maximize your Effort Values(EVs) by battling certain pokemon. Here's how it works:
1) You can obtain 510 EVs total per pokemon.
2) Each stat has a limit of 255 EVs, so you may divide the EVs amongst the stats in anyway you can.
3) A stat will raise by 1 point for every 4 EVs you get. This means you'll only want to put a maximum of 252 EVs in one stat
4) You can only obtain EVs if you gain experience points or haven't reached your 510 limit.
So lets take Breloom in for example. Say you want an EV spread that looks like this:
4 HP / 252 Atk / 252 Spd
So we catch/breed a shroomish and we battle a Zizagoon. For defeating a Zigzagoon, Shroomish will gain 1 Spd EV. Once he defeats 4 Zigzagoons, his Spd stat will increase by 1, but that only counts towards his Speed Stat Total once he has reached level 100. In other words, you won't see the actual change right away.
You may continue this process by defeating the necessary Pokemon for the corresponding EVs. You can find a list here:
https://db.gamefaqs.com/portable/gbadvance/file/pokemon_emerald_ev_points.txt
There are three ways to further along the EV training process:
1) Use Rare Candies. These will increase your Pokemon's level, but not their EVs. But this way, you can battle higher leveled Pokemon that you may need EVs from.
2) The Macho Brace will multiply the EVs you gain by 2. So if a Pokemon holding a Macho Brace defeats a Skarmory, it will gain 4 Defense EVs instead of the usual 2.
3) There is a beneficial virus called Pokerus. While a Pokemon is inflicted with Pokerus, the EVs it gains is multiplied by 2. Combine this with the Macho Brace, and the total amount of EVs you gain from a Pokemon is now increased by 4!
EV training can be a simple, but time consuming process. Keep in mind that you also need some knowledge in the Pokemon's base stats and/or Standard EV spreads for Pokemon for an efficient EV spread for a Pokemon. It's not too necessary for most in-game situations, as you can overpower most of the trainer's Pokemon, but for competitive battling with your friends, the Battle Frontier, and DEFINITELY NetBattle, it is quite beneficial to know your EVs.