What happens if I trade my last Pokemon in a family to the professor?

Solution 1:

Yes you do. All candies you have are stored kinda invisibly on your character and the only way to see them is by selecting a Pokemon of the evolution chain. If you get rid of all of the Pokemon in that chain you will keep the candies but be unable to see them until you catch another of that chain.

Solution 2:

Yes, you will retain all candies from this family.

I personally recommend getting rid of all Pokemon under 80% of the Combat Power (CP) arc (the semicircle above the Pokemon) filled and to not evolve or power up any Pokemon (other than Ratata, Pidgey, or Spearow) until level 10 when you start catching higher CP Pokemon. This is to conserve those candies for when they actually matter instead of wasting them (and Stardust later) to power them up.