Man overboard is fairly common for those who spend time on the water and happens for a variety of reasons, including capsizing of the boat, foul weather, vomiting or urinating over the side of the boat, seasickness, the use of alcohol or drugs, sitting on the gunwales, moving around on the deck without holding on, slipping on wet surfaces, being knocked over by the sail boom, or the boat making a sudden turn without warning. The best way to prevent going overboard is to wear a personal floatation device (PFD) while on deck, to hold on with one hand while on deck, avoid being on deck in fog, heavy weather, or at night without a lifeline, do not sit on the gunwales, avoid alcohol and drug consumption while on board, and avoid urinating or vomiting over the side without a lifeline.
If you fall overboard, it is important to remember and use the seven steps to survival: recognition, inventory, shelter, water, food, signals, and play. You should be wearing a PFD, which will keep your head above water even when unconscious. If your boat has capsized, then look for any floating water canisters/bottles, floating food, and anything you can use as a signaling device, such as keys, a mirror, flares, or colored objects. Then you need to keep yourself from panicking or becoming emotionally distraught by playing: using memories, jokes, storytelling, prayer, fantasies, and anything else that will keep your mind off your predicament.
If someone else falls overboard, work to get that person back on board quickly to avoid hypothermia and drowning. Throw the person a lifeline and pull them in.