I already saw that I get 3 candies when I catch a new Pokémon for the first time.
What are the others ways to get candies?
You can get candies by:
1) Catching the Pokémon type. E.g. catching a Pidgey will get you 3 Pidgey candies. If you catch a Pidgeot you will also get Pidgey candy, and probably 4 or 5 candies since you caught an evolved version of that pokemon.
2) Hatching eggs. There is no definitive answer to how much you get as it seems to be random, but you can get around 8 to 15 candies of that Pokémon you hatched.
Update:
On hatching eggs:
2KM egg: 5 to 15 candies
5KM egg: 10 to 21 candies
10KM egg: 16 to 32 candies
3) Transfering pokemon gets you back 1 candy of that kind. Bear in mind that the Pokémon will be removed permanently.
4) Evolving. You get 1 per evolution.
5) Using rare candy! A rare candy can be given to any Pokémon. You can get these in various ways:
Completing a week worth of daily research tasks (chances of getting them are random).
Monday 9 am walking tasks. Walk 25km or more in one week. If you walk 5km, you just get Pokéballs. If you do 25km, you get the Pokéballs and various other items, with a chance of rare candy, and 50km is 25km prize + extras. Again, more rare candy is a 50/50 possibility.
Winning a raid. I used to think the higher the tier of the raid the more rare candy you got, but this isn't true. Sometimes I've got 6 from a 5 tier, and sometimes I've got 1. They seem to be random. This can also be said about different tiers.
Given as rewards in daily research tasks. There is one currently that says hatch 5 eggs with the reward as 3 rare candy, although bear in mind these tasks change up every 3-6 months or so, so if you're reading this in a years time it's possible it doesn't exist.
All rare candies can be given to any Pokémon you have so if you're wanting to evolve a Pokémon you have that you can't find in the wild anymore, rare candy is much handier than catching them.
6) Use Pinap berries (yellow pineapple berries) when catching a Pokémon. This will give double the usual amount you catch. Also, note that during some special events, Pinap berries can give more candies than expected.
7) Add the pokemon as your buddy. Walking your buddy will get you 1 rare candy per amount required. Some pokemon only require 1km, while others are 3, 5 10, and even 20. Walk these are earn 1 candy per distance required.
Every time you catch a Pokémon from the same Evolution Tree (e.g. Pidgey, Pidgeotto and Pidgeot) you get between 3 and 10 candies:
These are labelled as the base evolution candy (e.g. 'Pidgey Candy'). You can build up candies quickly this way. You can also apply Pinap or Silver Pinap berries when catching Pokémon to double the amount you can collect.
You can also gain additional candies by Evolving, or Transferring Pokémon to Professor Willow (1 per evolution/transfer, and 1-3 per trade with another player). Note: Trading will also remove the Pokémon from your collection permanently.
The only other way of obtaining candies is through hatching Pokémon. This is similar to catching Pokémon; apart from the inability to know exactly what you will hatch, but with the bonus of receiving a larger quantity:
The Buddy feature has also been added into the game that allows you to get candy from a specific Pokémon you have set as your buddy, which gives candy per distance walked similar to hatching eggs.
The only other addition is using Rare Candies, which you can collect from Research, Raids, or Trainer Battles. These are not specific to any kind of Pokémon, but can be applied to a Pokémon, and it will trade 1 rare candy for 1 candy for that Pokémon.
If you transfer a Pokémon to Professor Willow you can get a single piece of candy of the Pokémon you transferred.
For hatching eggs I've received between 5-17 candies. It seems random. I've heard friends who have received upto 20 candies from hatching.