The mechanism for putting on muscle and adding bone density is simple: (1) eat more protein, and (2) get enough energy to fuel the growth, whether that energy comes from stored fat or from dietary fat. If you eat a ketogenic diet to satiety, your body will set your appetite at a level that will permit both. Since the body sets a limit to how much energy can be derived from stored fat in a day, the appetite will be set at a level that will permit energy to come from both stored and dietary fat.
The mechanism for shedding excess stored fat is also simple: (1) lower insulin by ceasing to eat too much glucose (i.e., carbohydrate), and (2) get enough energy to avoid putting your body into famine mode. If you eat a ketogenic diet to satiety, your body will set your appetite at a level that will permit the shedding of any excess stored fat you may happen to have. Since the body sets a limit to how much energy can be derived from stored fat in a day, the appetite will be set at a level that will permit energy to come from both stored and dietary fat.
Figuring out how to do both simultaneously is left as an exercise for the student. And we know it can be done, because it’s been observed during a number of studies and reported anecdotally on these forums.