The first rule is to stay calm at all times. Panic can cause death in an instant. Take several minutes to tread water as you calm yourself down and assess the situation. How far away is land? How long are you likely to need to float? Is there any debris to help as a flotation device? Do what you can to calm down.
Throughout the next steps, it is important to tread water with the legs the whole time.
Shoes will only wear you down, so they are the first to go. Carefully remove them without letting them leave your grasp. Remove the laces and discard the shoes. The laces can be used to tie off ends or tie the flotation devices to you so they don't float away.
Squirm out of your pants while treading water. Tie the ends of the pant legs off by just knotting the ends or using the shoe laces. Zip up the zipper. Now squeeze as much water out of them as you can. Some fabrics won't be able to release much water but that's alright. Now hold the waist open while you wave the pants overhead to fill them with air. Quickly knot off the waste to trap as much air in them as you can. They are now ready to float on. Use the shoe strings to tie them to you if necessary.
Take off your shirt and tie off the arms and neck. Squeeze out as much water as you can. Wave it over your head just like you did the pants. When it is filled with air, tie off the bottom to trap the air.
Assess any other clothing you have on or anything else you were carrying. Tote bags and backpacks can be used for flotation devices the same way clothes can by filling them up with air and tying them off. Long socks can be used for to tie things off, to keep your feet warm in freezing water, or as flotation devices. Sundresses can be very effective flotation devices and hold a lot of air. Even tank tops can be used to hold air.
Discard unnecessary items that will only serve to weigh you down. Jewelry and watches are unnecessary. So are any items left in your pockets. Hats may be kept on to keep cold wind off your head. And they serve to flag down helicopters especially if they are bright colors.
Replenishing the air in your flotation devices may be needed from time to time and can be easily done. Just untie the waist of your pants or the bottom of your shirt and wave it around your head to fill it with air. Then retie them.No-one relishes the thought of having to stay afloat for hours on end. But it is good to keep in mind that the clothes on your back can save your life.