The math is somewhat complex, but it's listed out here:
http://pokemongo.gamepress.gg/pokemon-stats-advanced
At the most basic level (and someone can correct me if I don't have this right), the tl;dr version is that a pokemon's CP is essentially a combination of base stats x level multiplier. So as you power up (i.e., level up) a pokemon, the level multiplier increases, which then increases the overall CP.
As CP is directly related to stats, another way of thinking about it is that every time a pokemon levels up, it's stats all increase by X (where X is a number determined from the level multiplier formula).