It'll work slightly differently according to which Pokémon you Buddy up with - in short, rarer Pokémon will take longer to produce Candy - and there's a few quirks and exceptions you should take ...