The science of floatation is simple yet equally interesting to know and let me explain it for you in the simplest manner possible. Now you know that every body or object has got a volume which means that if that object is placed on the surface of the water, it will displace water which is equal in volume to the volume of the object immersed inside the surface of the water (let me add here that I am using the term water in context of sea and ships, otherwise this principle applies to all fluids).
The volume of water that has been displaced certainly possesses a certain amount of mass which is given by
Mass of water displaced = volume of water displaced * density of water
Density of fresh water is normally 1000 kg/m3 and varies slightly whether the water is salt water and so on. Now Archimedes tells us that this mass of water displaced actually acts to push the object upward and it causes and apparent loss of mass of the object placed on water by an amount equal to the mass of water displaced.
The upward force exerted by this displaced volume of water is known as the force of buoyancy. This force can be assumed to act at a single point on the body which is known as the center of buoyancy of the body. And this center of buoyancy of the body is the same as the center of gravity of the part of the body which is immersed inside the water. It is this force of buoyancy which keeps the object pushed upwards and prevents it from sinking.