It's generally understood that a person eating more calories than they require throughout the day will gain weight, someone eating the same amount they require will stay the same, and someone eating less than they require will lose weight. This concept is called "energy balance."
This concept forms the basis for nutritional recommendations like "eat 500 calories less per day in order to lose one pound per week." The idea is that one pound of fat represents roughly 3,500 calories, and if your body needs 500 more calories than you ate in a day it will look to your stored body fat to make up the difference. Thus, having burned 500 stored fat calories per day for seven days, you'll have lost one pound. If you're consistently overeating, this math will likely work just fine, assuming you know how much you're eating as a baseline. If you're consistently undereating, this formula becomes considerably more complicated.
Your metabolic rate is made up of three primary factors: BMR, TDEE, and TEF. BMR represents the amount of fuel you need in order to exist - this is called your "Base Metabolic Rate" or BMR. It is dependent on your body side, body composition and genetic factors. TDEE represents the amount of fuel you burn during activity - this is called "Total Daily Energy Expenditure" or TDEE. It is dependent on the type of job you have, how hard you think throughout the day, and how much you exercise. TEF represents the amount of fuel you need to do the work of digestion - this is called the "Thermic Effect of Food" or TEF. It is dependent on the type of foods you eat, the efficiency of your digestive system, and again to some degree on your genetics.
BMR is highly complex to calculate, but can be estimated simply by multiplying your bodyweight by 10. This represents the minimum amount of food you need in order to maintain proper function.
TDEE is less complex. If your job is a sedentary desk job, you can assume that this represents primarily exercise activity. If you're active throughout the day - constantly on your feet, or performing manual labor you'll factor this in as low intensity exercise throughout the day in addition to exercise. Exercise calories burned depends on your level of conditioning, your body weight, and your exercise intensity, among other things. We know intuitively that a leisurely walk burns less calories than an hour of intense swimming, but exactly how much we need to eat to compensate for activity can be quite difficult to determine.
TEF, not surprisingly, is also complex to calculate, but can be estimated at 10% of calories consumed. The thing to remember here is that unprocessed foods require more work by the body to process, and thus have a higher TEF than foods that are highly processed.
Calories burned = BMR + TDEE + TEF
In the simple case, if Calories consumed < calories burned, you will lose weight, but there is a lower limit. Calories consumed - TDEE - TEF must be greater than BMR, or your body will begin to shut down critical functions like rebuilding muscle, growing hair, and menstruating in order to continue existing. This is the underlying source of the discussion about metabolic damage (admittedly oversimplified). If you eat too little and/or exercise too much your body will shut down key functions and simultaneously store fat. In this case, rather than continuing to reduce intake hoping for better adherence or different results, it's almost certainly necessary to slowly increase intake in order to essentially restore your body's willingness to part with stored energy.