You might not have realized it, but boat insurance is the oldest kind of insurance there is. People have been insuring their boats since the 17th century, and over time a number of standards have arisen. The chances are, though, that you're probably much more familiar with car insurance - so the good news is that car insurance and boat insurance are actually very similar.
Basically, there are three situations you can be insured against: your boat (or its cargo) being damaged, your boat sinking, and your boat hitting another. Although few countries make it a requirement that your boat must be insured (considering how many boats sail in international waters), you would be very wise to at least buy the third party insurance, in case you hit a boat that is very much more valuable than your own. You will probably find it quite unnecessary to insure your boat against total loss unless it is very valuable. It is mainly practical for large ships, and especially for ones carrying valuable cargo.
As with car insurance, policies come with an excess to discourage small claims - for boat insurance, this is usually quite a large sum of money, as the intention of the insurance is to cover you against substantial losses instead of just scratches and dents.
There are also a few kinds of insurance you can buy that are unique to boating, although it is unlikely that you will ever find yourself in need of them. If you get Increased Value insurance, your policy will pay out at your boat's market value if it is more than the amount you insured it for - only useful if you expect your boat to go up in value. Finally, if you're thinking of sailing into a warzone, you might want to get war risk insurance. Of course, you might also want to get your head checked out, if you know what I mean.