I was reading the Hall-Knight Higher Algebra book, came across this section a couple of days ago and had the same question. Anyway, answering your questions:
Now, here I am not able to understand why $a^mb^nc^p\cdots$ depends on $\left(\frac{a}{m}\right)^m\left(\frac{b}{n}\right)^n\left(\frac{c}{p}\right)^p\cdots$ for being the greatest?
It doesn't.
Since $m^mn^np^p\cdots$ is a constant value, say $k$, maxing out $\frac{a^mb^nc^p\cdots}{k}$ implies maxing out $a^mb^nc^p\cdots$ and it helps with algebraic gymnastics to arrive at the required solution.
But approaching the solution from this angle does not help much as I experienced.
Also, can anyone please explain how the author got $m^mn^np^p\cdots\left(\frac{a+b+c+\cdots}{m+n+p+\cdots}\right)^{m+n+p+\cdots}$ as the greatest value?
Fellow victim of Hall-Knight Higher Algebra text book, I shall help thee...
Since the book says $a+b+c+\cdots$ is a constant, we shall denote it by $s$
$$
a+b+c+\cdots=s
$$
This can be re-written as,
$$
\begin{aligned}
s&=m\left(\frac{a}{m}\right)+n\left(\frac{b}{n}\right)+p\left(\frac{c}{p}\right)+\cdots \\
&=\underbrace{\left(\frac{a}{m}+\frac{a}{m}+\cdots\right)}_\text{$m \text{ times}$} +
\underbrace{\left(\frac{b}{n}+\frac{b}{n}+\cdots\right)}_\text{$n \text{ times}$} +
\underbrace{\left(\frac{c}{p}+\frac{c}{p}+\cdots\right)}_\text{$p \text{ times}$} + \cdots
\end{aligned}
$$
From the general AM-GM inequality we have,
$$
\left(\frac{a_1+a_2+\cdots+a_r}{r}\right)^r \geq a_1a_2\cdots a_r
$$
Applying this to the previous equation on $s$, we get
$$
\left(\frac{\frac{a}{m}+\frac{a}{m}+\cdots+\frac{b}{n}+\frac{b}{n}+\cdots+\frac{c}{p}+\frac{c}{p}+\cdots}{m+n+p+\cdots}\right)^{m+n+p+\cdots} \geq \left(\frac{a}{m}\right)^m\left(\frac{b}{n}\right)^n\left(\frac{c}{p}\right)^p\cdots
$$
Notice that the numerator on the LHS is $s$. Upon simplification we get,
$$
m^mn^np^p\cdots\times\left(\frac{a+b+c+\cdots}{m+n+p+\cdots}\right)^{m+n+p+\cdots} \geq a^mb^nc^p\cdots
$$
From the above result, it is clear that the max. value of $a^mb^nc^p\cdots$ is
$$
m^mn^np^p\cdots\left(\frac{a+b+c+\cdots}{m+n+p+\cdots}\right)^{m+n+p+\cdots}
$$
and we're done.
PS: I personally think that starting the solution by maxing out $\left(\frac{a}{m}\right)^m\left(\frac{b}{n}\right)^n\left(\frac{c}{p}\right)^p\cdots$ is a bit confusing.