Handling emergencies at sea is one of the most crucial seamanship skills a captain needs.
Preparing for emergencies
"An ounce of preparation is worth a pound of cure," should be every captain's motto.
Now ideally it would be great if you filled out a proper float plan, however, baring a long voyage, most people won't take the time. Even just shooting a note to a friend is better than nothing. It can be as simple as: "Hey I'm heading south with Bob from Ft Lauderdale to Miami. ETA 4 p.m. Check in if you haven't heard from me by 5." All recommendations from the Coast Guard, however, do recommend filling out a proper float plan and the Coast Guard consistently says that, "Float plans save lives." 
Watch the forecasts and know the area you're in. A bad forecast on the intercoastal is different than bad weather on gulf stream. Fish can be caught another day. Wind and lightening are the two biggest enemies here. If it's a drizzle and no wind, then go get wet, but check your bilge cause now you have water coming in from all sides.
3 checks that will save your ass before heading out:
- VHF check (Seatow has an automated service for this)
- Safety equipment. USCG minimum is here and it's a minimum.
- Drain plug, bilge pump, bilge for water (after 1 hr at sea) - When people say a boat capsized, 99% of the time they mean it foundered.
- Safety equipment. USCG minimum is here and it's a minimum.
- Personal Flotation Devices for everyone onboard
- Bell or Whistle
- Visual distress signals approved for day and nighttime use
- Fire extinguisher (B-I type - 2 for boats over 26 ft)
- Ventilation (any major boat brand or outboard will have this covered for you)
- Back-fire Flame Arrestor for inboard carb motors
- EPIRB - basically the same thing as a PLB, but EPIRB is at least double the battery life (a minimum of 48 hours). An EPIRB is registered to a vessel, whereas a PLB is registered to a person. These are GPS beacons that activate when in the water instantly sending out your location and a distress signal to the Coast Guard even if you don't get a VHF call off in time. They save lives and are worth a couple hundred dollars. 
- "Rescue kit" for your boat. There are things you know(or should know) are iffy with your boat, you should have a way to patch/repair these things, even if it's only temporary, a 6" section of garden hose and some zip ties have fixed multiple issues on various boats as well as a tube of underwater 2part epoxy, it's a pain to clean up on shore for the proper repair, but hell at least I'm on shore!
- An old sailor's trick is to keep a wax toilet ring on board. Have water coming in from somewhere? Smash the wax ring into the hole and stop the water. Also, a spare bilge pump with a long hose and alligator clips on the power cord so that you can put it anywhere on the boat that you need it.
- First aid kit
- Extra flairs
- Portable, waterproof VHF
- Waterproof flashlight
The best way to prepare for an emergency is through practice. Crews who run through safety drills on a periodic basis are much more likely to react appropriately when the real thing happens. When you’re practicing, it is important to follow the decision-making process and plan of action that would be involved in an actual emergency. Once the situation, goals and resources of a particular drill or emergency have are nothing will take place in the manner for which you practiced. Therefore, the been established, it’s time to put together an action plan. There can be only one single most important factor in any emergency – the person “in charge,” most likely the boat’s owner or skipper. Begin by clearly and calmly assigning a specific task or tasks. Make sure each person knows and understands what he or she is expected to do (and not do), and make sure he or she is physically and mentally capable of carrying it out. As you proceed with the exercise, calmly and clearly tell everyone what is going on, what will happen next and what everyone should be doing. With proper preparation, most serious emergencies can be dealt with in a way that minimizes the risk to persons on board and maximizes chances of survival. 
Procedures for when emergency occurs
Aircraft pilots have a saying for emergencies: "Aviate, Navigate, Communicate." This is very similar for the procedure on the water. For boaters and skippers, the saying can be altered to be: "Operate, Navigate, Communicate".
Your first duty as captain during an emergency is to operate the vessel to avoid any immediate threats and to demand that all crew and passengers put on their life vests at the first sign of concern. This can not be stressed enough. Emergencies often start out as small issues and grow. By the time you're certain you need a life vest, it could be too late. If the vessel is not headed toward danger and everyone has their life vests on, then your next duty as part of this step is to triage and address the issue. Small fires, for example, are something that should and could be addressed quickly to prevent turning an emergency into a disaster.
Navigation includes the operation of the vessel beyond the immediate 50 feet in front of you. If you're underway, ensure that you're not headed towards danger and take note of your position for the next step. If you're not underway, then make sure you won't drift into danger and take note of your position for the next step.
Communicate early and often is a good rule of thumb.
For urgent issues, a VHF pan-pan call should be your THIRD action item when anything that could cause problems happens. A pan-pan call is less than a mayday call. It is to advise boats in the area that you could be running into problems and gives them information which can be used if shit goes sideways, but there is no immediate danger. It is much easier to make this call when you encounter a problem and then update it to a MAYDAY call later than it is to try to convey all the proper information when things get really interesting. The proper format for this is:
"Pan-pan pan-pan pan-pan, all stations all stations all stations, this is <vessel name, vessel name, vessel name>. My position is: <position>. I say again <repeat position>. BREAK Be advised, I am <situation> heading <heading> (if still underway). I require <requirements>. (Could be that you do not have any immediate requirements). I have <number of people onboard> souls onboard with <conditions>. My vessel is <condition of vessel> and <description of vessel>. We are equipped with <equipment>. I will be listening on <VHF channel> (16 is usually a safe bet if you're in the shit.) This is the <vessel name>. Over.
If it is more than urgent, read emergency, then you should use use a VHF mayday call. A mayday call is used to signal a life-threatening emergency. If your passengers, your vessel, or yourself are in a life-threatening emergency, do not hesitate to use mayday instead of pan-pan. However, this call will immediate deploy resources, ranging from the Coast Guard and law enforcement to vessels in the area, to your location. Use this call with that understanding and the understanding that hoax mayday calls are illegal. The procedures for a mayday call are the same as a pan-pan, however, replace the word "pan-pan" with the word "mayday".
"Mayday, mayday, mayday, all stations all stations all stations, this is <vessel name, vessel name, vessel name>. My position is: <position>. I say again <repeat position>. BREAK Be advised, I am <situation> heading <heading> (if still underway). I require <requirements>. I have <number of people onboard> souls onboard with <conditions>. My vessel is <condition of vessel> and <description of vessel>. We are equipped with <equipment>. I will be listening on <VHF channel> (16 is usually a safe bet if you're in the shit.) This is the <vessel name>. Over.