The moment of inertia is needed to calculate the rotational movement of a body. You can think of it as the rotational equivalent of mass. To calculate the moment of inertia you have to integrate the area (volume in 3D) of the polygon in respect to the rotational axis (most often than not an axis through the center of mass). Integrating is slow and hard to do with an arbitrary polygon, so here is an easy way to do just that.
First the polygon is triangulated by fanning around the centroid (center of mass), so that the centroid is part of every triangle.
Now the centroid of the triangle and the moment of inertia of the triangle about an axis through the center of mass of the triangle ( try to say that ten times fast in a row) has to be calculated.
But the original polygon rotates about an axis through the centroid of the original polygon, so we have to use the parallel axis rule. The rule states that the moment of inertia about an axis parallel to one through the centroid can be calculated by adding the mass ( in this case we use the area of the triangle as mass) multiplied by the squared shortest distance to the parallel axis.
The last step is to sum-up all moments of inertia of the triangles and you are done.