Buoyancy is determined by a lot of competing factors on a scuba diver. The net effect, however, is that you are either positively, negatively, or neutrally buoyant. For recreational divers, you are usually positively buoyant (at the surface). Weights are used to offset this positive buoyancy and make you slightly negatively buoyant, in order to sink to depth. Choosing weights may feel largely like guesswork, but there are physical principle at work as you dial in to your ideal weighting.
The most basic principle at work is Archimedes' principle, which states that an object in a liquid is buoyed up by a force equal to the weight of the liquid displaced by the object. Imagine we put a ball in a pool, and the ball is 5 liters in size. The ball will displace 5 liters of water, since the water has to move when the ball is placed in it. 5 liters of water weights 5 kg, so the ball feels like it weights 5 kg less when in the water. If the ball is less than 5 kg, then it becomes positively buoyant. If it is more than 5 kg, it is negatively buoyant, because an upward force of 5 kg is not enough to counteract the weight of the ball. If the ball is exactly 5 kg, it is neutrally buoyant. Archimedes' principle relates the amount of a liquid displaced to the buoyancy provided.
We have all we need to know to do computations in fresh water, but not for sea water (or for the general case of any fluid). The missing factor is how much the liquid weights per unit volume. This is the density of the liquid. Rather than dealing with the density of the liquid directly, we can just use the ratio of the fluid's density to the density of fresh water, which weights 1 kg / 1 liter. This number is called the specific gravity^1^ of the liquid.
The specific gravity of fresh water is exactly 1, because it's the ratio of a number (the density of fresh water) to itself. The specific gravity of salt water is 1.03. This means a liter of salt water weights about 1.03 kg. This is enough for scuba diving. If you ever find yourself diving in anything else, you may need to look up the specific gravity of that liquid. :)
Quick recap: Archimedes' principle tells us that an object (including you!) in water is buoyed by the weight of the displaced water. Specific gravity tells us for a given volume of displaced water (either sea or fresh), how much it weights. We can use these to compute the exact amounts needed to make something neutrally buoyant, or positively / negatively buoyant by any amount.
Let's say a diver weights 80 kg with all their gear on, and the volume taken by them (and all the gear) is 90 liters. We can ask the question
Is the diver positively, neutrally, or negatively buoyant in the ocean?
To answer this question we need to know how much the displaced water weights. The specific gravity tells us that 1 liter of sea water weights 1.03 kg. The problem says that 90 liters of sea water is displaced, so 90 liters of sea water weights 90 l * 1.03 kg / l = 92.7 kg. This means the water is "pushing up" on the diver with a force equivalent to 92.7 kg. However, the diver weighs 80 kg, so this is more than enough to stop them from sinking. Thus, the diver is positively buoyant.
How much weight is required to make the diver neutrally buoyant?
We know the diver is positively buoyant, but by how much? 92.7 kg - 80kg = 12.7 kg. If we put 12.7 kg of weights inside their pockets, they would be neutrally buoyant. Anything more than that would make them negatively buoyant, and they would sink.
Example 1 showed how we can compute exact weighting requirements, but we don't do this in real life. In real life finding the weight and volume of the diver would be too cumbersome. Instead, the first time with a gear setup in certain water we find the correct weighting through trial and error. We then make modifications in future dives based on that amount of weight.
Here's a common question seen with these types of problems. Imagine we lose something heavy off the boat into the ocean, such as an untied anchor. The anchor weighs 100 kg and is 50 liters in volume. A person can't lift the anchor from the bottom, so we want to attach a lift bag filled with air to buoy it to the surface.
How big of a lift bag do we need?
To answer the question, we first need to know how negatively buoyant the anchor is (if it sank it's clearly negatively buoyant). It displaces 50 l * 1.03 kg / l = 51.5 kg of sea water, but the anchor weighs 100 kg. This means we need at least 100 kg - 51.5 kg = 48.5 kg worth of additional buoyancy from the lift bag to make the anchor float.
The problem asks for the size of the lift bag, which is in liters, but we only know the weight needed. This means we need to displace more sea water using the lift bag. How much sea water? 48.5 kg. How much volume will displace 48.5 kg? 1.03 kg of sea water is 1 liter, so we can convert. 48.5 kg / 1.03 kg / l = 47.09 liters. This is all air, which weights so little we can practically ignore it.
The answer then is that we need a lift bag that can hold at least 47.09 liters. By the way, this is how your BCD works. When you inflate it, your volume becomes bigger without changing your weight, so you displace more water and become more positively buoyant.
Another side question we can ask is
If the anchor is in 10 m (33 ft) of sea water, how big does the lift bag really need to be?
The lift bag needs to be 47.09 liters to make the anchor positively buoyant, but there is another principle at work here: as the lift bag moves towards the surface, the volume will expand. For a depth of 10 m, the volume will double as it reaches the surface. We not only need a lift bag that holds at least 47.09 liters to begin ascending the anchor, but it also must be able to hold at least 2 * 47.09 = 94.17 liters so that it doesn't explode before reaching the surface.
These problems may seem confusing at first, but are easy after working through a couple. Even if you never find a use for them in real life, they are required for most divemaster-level examinations.
1. Modern science prefers the more descriptive term relative density over specific gravity, but many textbooks (including diving references) still use specific gravity, so we use it here.