$$n^{n-2} = 16$$
I know $n = 4$ through trial and error but how do you find $n$ in a conventional manner?
I'm basically trying to solve how many nodes are in a tree that has $16$ spanning trees which through trial and error and using the right formulas, it equates to $5$.

$n=3$ is not a solution. $n=4$ is solution. If $n\ge 5$, then $n^{n-2} \ge n^{5-2}=n^3 \ge 5^3>16$, so, $n=4$ is the only solution.