Every time that I evloved a pokemon, regardless of the price of evolution in candies, after the evolution has happened I’ve got 1 extra candy left. For example evolving a Voltorb into an Electrode with 67 candies, would leave me with 18 candies and not 17 as expected (The evolution costs 50 candies). But, if I’m lacking only one candy for the required amount (49 in the case of Voltorb), I’m unable to evolve.
Where does that extra candy come from?
You have one extra candy because you get one candy for evolving pokemon. You still need 50 candies to evolve a Voltorb, but you get one candy back for evolving him.