Weight loss is simple science--burn more than you consume and create a deficit which = weight loss. Many people subscribe to the "starvation" theory....meaning if you create a situation through deprevation that mimics starvation, the body will begin to hold on to everything in preparation for total loss of food. Recently, some studies have indicated that is not how our bodies really work.......I don't think there is enough evidence yet though to change my mind (I do believe you can have consumption so low that your body will react by "saving up".....I'm living proof of it after years of starvation diets!!)
However, there are a lot of moving parts to this science. You need to do what you can to insure against muscle loss....and after weight loss surgery, no matter what you do, you will lose some muscle.
Protein consumption will help muscle recovery. You also need complex carbs for quick energy. For me, I do much better eating 6 small meals a day to provide a constant source of energy for my metabolism. My fat burning ramped up once I did this and ensured I was getting enough calories per day (for energy to continue the workouts). The fact that I have a lot more muscles now also improved my metabolism.
To guarantee you are consuming less than you are taking in, you'll need to be able to acurately account for what you are truly burining in a 24 hour period. There are several tools available for this (like the BodyBugg).
There are many other factors such as genetics, your resting metabolic rate, medications you may be on, thyroid activity....the list goes on....but that is the basics.