Just as with swimming, the ability to float relies primarily on body position. When gravity is removed from the equation, your head is allowed to direct the rest of your body. Imagine an arrow protruding from the center of the top of your head. When your arrow is pointing directly upwards, you are likely standing with your feet underneath your body; however, when your arrow is horizontal, you feet will be pointing in exactly the opposite direction. Thus, the lower your head is in the water, the better you will float. (When you are attempting to swim or float, you will need to point this imaginary arrow directly toward the side of the pool).
Another factor to bear in mind is the buoyancy of the water and your own body type. Water that is saltier is far more buoyant. Meaning that floating in the ocean or in a salt-chlorinated pool may be a good place to start because it is easier. Also, if your body has more fatty tissue, you will float more easily than those with leaner body types.
HINTS: If you’re still having trouble floating, don’t feel bad. Many people find it difficult, even with proper technique. If you seem to be one of these people, try lifting your chin away from your chest, spreading your arms and legs wide (in order to increase your surface area on the water), arching your back, taking a deep breath and holding it, bending your knees, or putting your arms above your head.