How many ways to multiply n matrices?
We see in OPs example all $5$ different ways to multiply four matrices according to the associative law. This corresponds to the Catalan number
$$C_3=\frac{1}{4}\binom{6}{3}=5$$.
We write these $5$ variants explicitely with dots and obtain
\begin{align*} &(((A \cdot B)\cdot C)\cdot D)\\ &((A\cdot (B\cdot C))\cdot D)\\ &((A\cdot B)\cdot (C\cdot D))\\ &(A\cdot ((B\cdot C)\cdot D))\\ &(A\cdot (B\cdot (C\cdot D)))\\ \end{align*}
We can bijectively transform this represention into strings of valid pairs of open and closed parentheses. We do so by skipping the matrices and all open parentheses and replacing the dots with opening parentheses.
\begin{align*} &(\ )\ (\ )\ (\ )\\ &(\ (\ )\ )\ (\ )\\ &(\ )\ (\ (\ )\ )\\ &(\ (\ )\ (\ )\ )\\ &(\ (\ (\ )\ )\ )\\ \end{align*}
In general we consider strings of length $2n$ consisting of $n$ open and $n$ closed parentheses. Valid sequences can be characterized, that parsing a string from left to right, starting with $0$ from the beginning and adding $1$ when reading an open parenthesis and subtracting $1$ when reading a closed parenthesis we always get a non-negative number. At the end we get $0$.
Now let's count the number $C_n$ of all valid sequences of length $2n$. The number of all sequences is \begin{align*} \binom{2n}{n} \end{align*}
A bad sequence contains $n$ open and $n$ closed parentheses, but reaches the value $-1$ at a certain step for the first time during parsing. When we have reached the value $-1$ we have parsed precisely one closing parentheses more than open parentheses.
We now reverse from that point on all parentheses, i.e. we exchange all open with closed parentheses and vice-versa. This results in a sequence with two more closed parentheses than open parentheses. So we have a total of $n+1$ closed parentheses and $n-1$ open parentheses.
It follows, the number of bad sequences is \begin{align*} \binom{2n}{n+1} \end{align*}
$$ $$
We conclude the number $C_n$ of all valid sequences of length $2n$ is \begin{align*} C_n=\binom{2n}{n}-\binom{2n}{n+1}=\frac{1}{n+1}\binom{2n}{n}\qquad \qquad n\geq 1 \end{align*}
In OPs example $n\geq 2$ matrices imply $n-1$ dots for multiplication. These dots can be substituted with $n-1$ open parentheses giving $C_{n-1}=\frac{1}{n}\binom{2(n-1)}{n-1}$ different valid arrangements.