You have to be specific on which game you are playing. But just as Ben mentioned, Victory Road is usually a good place to start.
There is a way to calculate the EXP you get, but it's kind of complicated. So, to put it simply, look at like this:
Every Pokemon has a base experience yield. This means that when you defeat a Pokemon, that number is the amount of experience you gain. However, it's compared to a bunch of multipliers that increase it.
Equation 1: a X t X b X e X l
Equation 2: 7 X s
a = 1 if it's a wild encounter, 1.5 if it is a trainer battle.
t = 1 if the winner was caught from the trainer using it, 1.5 if it was traded.
b = the base experience yield of the fainted Pokemon.
e = 1.5 if the item Lucky Egg is held by the winner, 1 if otherwise.
l = the level of the fainted Pokemon.
s = if no Pokemon are holding the Exp. Share, all Pokemon who participated and have not fainted count as +1 to the total value of s. If any Pokemon are holding the Exp. Share, count the number of Pokemon that have participated and have not fainted, multiply that number by 2 to get the value of s. As for all the Pokemon with the Exp. Share, count the number of Pokemon holding it, multiply it by 2 to get the value of s. Note that two equations must be performed for separate Pokemon, the first is for Pokemon participating and the second is for those holding the Exp. Share.
After you multiply all this nada, divide Equation 1 by Equation 2. That is how much experience your Pokemon will gain.
If you are too lazy to calculate all this for every battle, just follow these tips:
Find a way to rematch trainers with high leveled Pokemon, because there's a 1.5 multiplier for the experience you get if you do.
Aim to faint evolved Pokemon over pre-evolutions of that Pokemon, because they have higher experience yields and will give more experience.
Faint high leveled Pokemon as much as you can, these provide huge multipliers to the experience you get!
Know your Pokemon's level growth groups. Pokemon in the Erratic group need more experience, whereas Pokemon in the Fluctuating group requires less. Stronger Pokemon have slower growth rates.
Pokemon with no pre-evolutions or evolutions tend to have experience yields higher than standard wild Pokemon because they are considered 'fully evolved' and they don't have much of a reason to have lower base experience yields. You can find them in the wild unlike fully evolved Pokemon like Vileplume.
Take advantage of multipliers like the Lucky Egg. Utilize them as much as you can and you'll have high levels in no time!
That's all. If you're playing Generation 5 or 7, visit this page to see the formula there:
https://bulbapedia.bulbagarden.net/wiki/Experience#Experience_gain_in_battle