A body moving in a straight line continues to do so unless it is acted upon by a force. To rotate a body around in a circular path a force has to be applied on the body towards the center of the circle. This is called the centripetal force. If there were no centripetal force, the object would fly out, like a block being rotated by a string would if the string were to snap.
A centrifuge works on the principle of the necessity of the centripetal force. The force is given by the relation m*v^2/r. A heavier object requires a larger force to keep it rotating in the circular path and as the radius is increased the centripetal force required decreases.
In a centrifuge, a mixture of substances with different masses is rotated in a container at a very high speed. This pushes the lighter components towards the outer end and the heavier components stay towards the inner end. Due to the force with which the lighter components seem to be pushed out they move upwards and form a layer on top. Once a centrifuge has been run, separate layers are formed based on the mass of each of the components of the mixture that was put into the centrifuge.
They are simple devices usually driven by a motor that woks on the principle of sedimentation. Objects in a centrifuge is rotated around a fixed axis, thus applying a force perpendicular to the axis. The sedimentation principle uses the centripetal acceleration to evenly separate substances of varying density.