It uses electrical impedance to send a small electrical current through your body. The current travels through the water in your body. When the current returns to the scale it measures the amount of resistance that it faced while passing through your body, and that resistance will determine your total body water content. Your water content is used to estimate your lean mass, and it calculates the difference between that and your total weight to give you your body fat%.
These scales will give you a rough estimate of body composition, but they are not terribly accurate. For instance, someone with a significantly low bodyfat% or someone with a significant amount of muscle mass will get an inaccurate reading.