The best way to understand this kind of calculation is to first define a barycentre or center of gravity.
Definition: The barycentre of $n$ points $x_1,\dots,x_n$ with (strictly positive, for now) masses $m_1,\dots,m_n$.is $\dfrac{m_1x_1+\dots+m_nx_n}{m_1+\dots+m_n}$.
The motivation is that this definition has exactly the properties that one wants from a physical center of gravity, that is, in many applications, one can replace the $n$ points by a single point at the center of gravity with mass $m_1+\dots+m_n$.
In particular, the property that we want to use is:
Lemma 1: The barycentre of $n$ points $x_1,\dots,x_n$ with masses $m_1,\dots,m_n$ is the barycentre of the first $n-1$ points with mass $m_1+\dots+m_{n-1}$ and the point $x_n$ with mass $m_n$.
Proof:
The second barycentre in the lemma is given by:
$(m_1+\dots+m_{n-1})\cdot \frac{m_1x_1+\dots+m_{n-1}x_{n-1}}{m_1+\dots+m_{n-1}} + m_nx_n= m_1x_1+\dots+m_{n-1}x_{n-1}+m_nx_n,$
which is clearly the expression for the barycentre of all points.
Corollary: In the calculation of a barycentre, we can replace an arbitrary subset of points by their barycentre with the sum of their masses.
Proof: Just apply the lemma repeatedly.
Lemma 2: The barycentre of two points lies on the line containing the two points.
Proof: $\dfrac{m_1x_1+m_2x_2}{m_1+m_2} = x_1+ \dfrac{m_2}{m_1+m_2}(x_2-x_1).$
So the barycentre is the first point plus a multiple of the connecting vector $x_2-x_1$ which lies on the line.
Lemma 3: The barycentre $g$ of $x_1,x_2$ with masses $m_1,m_2$ has the property $\dfrac{\overline{x_1g}}{\overline{gx_2}}=\dfrac{m_2}{m_1}$.
Proof: $\begin{align} m_1\overrightarrow{x_1g}-m_2\overrightarrow{gx_2}&=m_1g-m_1x_1-m_2x_2+m_2g\\ &=g(m_1+m_2)-(m_1x_1+m_2x_2)\\ &=g(m_1+m_2)-(m_1+m_2)g=0 \end{align}$
Therefore, $m_1\overrightarrow{x_1g}=m_2\overrightarrow{gx_2}$. Dividing by the masses and taking the length of the vectors gives the desired result.
Example 1: In a convex quadrangle $ABCD$ the lines that connect the midpoints of opposite sides divide each other in parts of equal length and they meet in the centre of gravity of the quadrangle.
Why: To get the midpoint of $A$ and $B$ we have to put equal masses on $A$ and $B$.
So it is a natural approach to put masses of size 1 on every vertex and calculate their center of gravity $G$.
By the corollary above, we can calculate it in several ways:
Using lemma 1, we replace $A$ and $B$ with masses 1 by their midpoint with mass 2 and do the same for $C$ and $D$.
By lemma 2, the centre of gravity of these two points lies on the connecting line and since both masses are 2 it lies exactly in the middle.
Similarly, $G$ lies in the middle of the other connecting line of two midpoints.
Example 2: In the triangle $ABC$, $E$ is on $AC$ so that $CE=3AE$ and $F$ is on $AB$ so that $BF=3AF$. If $BE$ and $CF$ intersect at $O$ and line $AO$ intersects $BC$ at $D$, compute $\frac{\overline{OB}}{\overline{OE}}$ and $\frac{\overline{OD}}{\overline{OA}}$.
By lemma three, we want to place mass 3 on $A$ and a mass 1 on $C$ to have $E$ the center of gravity of the two points. Later, we want to connect $E$ to $B$, so we want to have this ratio 3 to 1 in the points $A$ and $C$. Similarly, we want the same ratio for $B$.
So, we want to investigate the three points $A$, $B$, $C$ with masses 3,1,1. (Note that if we wanted to regard the midpoint of $E$ and $F$ later, we would have chosen 6,1,1. The masses are freely chosen for the particular problem!)
Let the barycentre be $G$.
Now it is clear that $G$ is the barycentre of $B$ and $E$ with masses 3 and 2, respectively, so $G$ lies on $BE$. Similarly, $G$ lies on $CF$, so $G=O$ and $\frac{\overline{OB}}{\overline{OE}}=2/3$ by Lemma 3.
If we want to express $G=O$ as barycentre of $A$ and $D$, we just have to calculate first the barycentre $H$ of $BC$ which gets mass 2. Then we note that $H$ lies on $BC$, but by Lemma 2 also on $AO$, so actually, $H=D$.
And we conclude by Lemma 3 that $\frac{\overline{OD}}{\overline{OA}}=3/2$.
Remark:
If we are working with three points in the plane, every point of the plane is a barycentre of the three points if we place appropriate masses. If these masses are scaled to have some 1, they are the barycentric coordinates of the points of the plane. Since we allow negative "masses" in this case, one has to generalize the concept to the case where the sum of the "masses" is zero.
Barycentric coordinates or "mass point geometry" is the appropriate framework for affine geometry and is applicable whenever a geometry problem is only about ratios of lengths, that is, no absolute distances (including circles), no angles, no inner products.