The centre of gravity (CG) is the point at which the total weight of an object can be considered to act.
In other words, if you were to suspend the object from a single point, that point would be the CG.
Mathematically, for a system of point masses \$mi\$ located at position vectors \$\mathbf{r}i\$, the CG is given by:
\$\mathbf{r}{CG} = \frac{\sumi mi \mathbf{r}i}{\sumi mi}\$
For a continuous body with density \$\rho(\mathbf{r})\$, the formula becomes:
\$\mathbf{r}_{CG} = \frac{\int \rho(\mathbf{r})\,\mathbf{r}\,dV}{\int \rho(\mathbf{r})\,dV}\$
Key point: The CG is the same as the centre of mass for objects in a uniform gravitational field.
It is the point where the weight can be treated as a single force acting downwards.
Imagine a seesaw with two kids of different weights sitting on either end.
The seesaw balances when the torque on both sides is equal.
The point where the seesaw pivots is effectively the CG of the combined system of the seesaw and the kids.
If you moved the heavier child closer to the pivot, the CG would shift toward that side, making the seesaw tip.
A book hanging from a string will hang so that its CG is directly below the point of suspension.
If you cut the book in half, each half will still hang with its own CG below the string.
This demonstrates that the CG is independent of the shape of the support.
A uniform rod of length \$L\$ and mass \$M\$ has its CG at its midpoint:
\$\mathbf{r}_{CG} = \frac{L}{2}\$
So if you hang it from one end, it will tip until the midpoint is directly below the suspension point.