I think you're asking why the rule for division of fractions,
$$\frac{p}{q} \div \frac{r}{s} = \frac{p}{q} \cdot \frac{s}{r},$$
works.
And I'm assuming that you're already comfortable with how to multiply fractions.
We need to go back to what division is supposed to achieve in the first place. When we look into that, the answer is that $A\div B$ means something that gives $A$ when we multiply it by $B$ -- or, written in symbols, $A\div B$ means the $X$ that solves the equation $$ X\cdot B = A $$
When our $A$ and $B$ are fractions, the "reciprocal" division rule can be regarded as a trick that happens to produce an $X$ that works. It's easy enough to see that it does work: If we're dividing $\frac pq \div \frac rs$ we need to solve the equation
$$ X \cdot \frac rs = \frac pq $$
And indeed setting $X=\frac pq\cdot \frac sr = \frac{ps}{qr}$ does this:
$$ \frac{ps}{qr}\cdot\frac rs = \frac{ps\cdot r}{qr\cdot s} = \frac{p\cdot sr}{q\cdot sr} = \frac pq$$
like we want. (I'm also assuming that you're comfortable with cancelling the common factor $sr$ in the middle fraction).
This computation hopefully also gives some ides why it works, at least part way. In $\frac{ps}{qr}$ the $p$ and $q$ are what we want to end up with, and the $s$ and $r$ are there to "neutralize" the $r$ and $s$ we have but want to discard. By making sure that the product has exactly one $r$ and one $s$ on each side of the fraction bar they make sure we can cancel them away.
Writing the solution $\frac{ps}{qr}$ as $\frac pq\cdot \frac{\vphantom{p}s}{r}$ might be best understood as just an easy way to remember what goes where. But this memory trick itself then also serves as motivation for considering the reciprocal to be an interesting operation in its own right in higher algebra.