Under the hood pokemon have 3 values that determine cp - attack, defense, and stamina. Part of this value is determined by the "species" so every pidgey has the same base stats. Part of this is determined by the individual values or "IVs" of the pokemon. IVs do not change during evolution. Finally, this value is scaled according to the level of the pokemon. The pokemon's max level is tied to your trainer level - but it will increase as you level up.
If your goal is to eventually have the strongest pokemon possible, you must figure out which of yours have the highest IVs and powerup and evolve those, as IVs determine the maximum potential of the pokemon.
The actual CP calculation, where base values are for the species, ind values are the IVs of the specific pokemon.
(BaseAtk + IndAtk) * (BaseDef + IndDef)^0.5 * (BaseSta + IndSta)^0.5 * (ECpM)^2 / 10
ECpM is the CP modifier based on the pokemon level.
More information can be found here: