The Pokemon Go buddy system was introduced in September, 2017. Essentially it allows you to get candy for a specific Pokemon by simply walking with it.
To get buddy candy for a specific Pokemon, you will need to select it as your buddy. This can be achieved using the following steps:
Choose a Pokemon that you actually need candy for, not one that just looks cute to walk with.
It is important to note that if you have already selected a buddy Pokemon, that changing them will cause any progress you have made towards the next candy to be lost.
A notification will appear each time your buddy Pokemon earns a candy. It is at this point it would be best to change your buddy Pokemon, should you wish to do so, as no walking distance is wasted.
Buddy candy is rewarded after walking a certain distance with your selected buddy Pokemon. The distance required to walk varies between different species.
Generally, the rarer the Pokemon, the further you will need to walk to generate a candy. This is because rarer Pokemon are naturally harder to find in the wild
For example the likes of Pidgey are just 1km per candy whereas a rarer Pokemon such as Magmar are 5km. All legendary Pokemon such as Articuno and Lugia are 20km. Pokemon of the same evolution line, for example Charmander, Charmeleon and Charizard, always require the same walking distance.
You should always a select a Pokemon to buddy up with that you need candy for. This could be because it's a powerful Pokemon which you want to power up or you could be close to evolving it. Basically you should have a goal in mind for that Pokemon.
How far you need to walk to earn that candy also needs to be considered. For example if you have an average IV legendary Pokemon, it isn't worth walking the 20km to earn a candy. In contrast, if you are one candy away from being able to evolve a high IV Vulpix, then it's worth selecting it.
A lot of Pokemon Go trainers ask the question which buddy Pokemon sit on your shoulder. Well, here is that list. Pikachu is special whereby it will move to your shoulder after walking 10km.
There are also Pokemon which can be held in your arms. They are as follows: