Say Ditto uses its "Transform" Ability to become a Klefki, then Klefki uses its "Wonder Lock" Ability to attach it to another Pokemon as a tool. When doing this what happens to the Ditto and Klefki cards?
The Ditto card gets discarded when Klefki is attached as a tool.
Source: TPCi Rules Team (2019-01-24)
If I have Ditto with "Transform" in play this turn, on my next turn can I put a Basic Pokemon from my hand on top of Ditto and then immediately evolve it into a Stage 1 or use Rare Candy to evolve it to Stage 2?
Yes, you can. Ditto says "Any cards attached to this Pokemon, damage counters, Special Conditions, turns in play, and any other effects remain on the new Pokemon"; so as long as Ditto has been in play for more than a turn it satisfies the evolutionary requirement, and the Basic Pokemon card placed on Ditto can be evolved or used with Rare Candy immediately.
Source: Boundaries Crossed FAQ (2012-11-08), TPCi Rules Team (2012-11-08)