Minecraft wiki entry for Development_versions, associated text: When the villager's trades are restored to full, it takes whatever supply was used up (number of trades), and converts that into a price increase called "demand". Demand goes up by the amount of supply used, and down by the amount of supply not used.
When villagers make trades, they gain experience. When they gain enough experience, they level up. Leveling up unlocks new trades, which are locked until the villager is at the appropriate level.
one trade equals one level up.