How to prove a known inequality from a book
The following proof was inspired by Fedor Petrov's and Gjergji's Zaimi's argument, but it is simpler.
By a scaling argument we may assume $a_i\in[1,A]$, $b_i\in[1,B]$. The inequality can be rewritten as $$x^{1/p}y^{1/q} \leq (A^pB^q-1)\sum_{i=1}^n a_ib_i,$$ where $$x:=p(AB^q-B)\sum_{i=1}^na_i^p\qquad\text{and}\qquad y:=q(BA^p-A)\sum_{i=1}^nb_i^q.$$ By Young's inequality $x^{1/p}y^{1/q}\le \frac{x}{p}+\frac{y}{q}$, the above follows from $$\frac{x}{p}+\frac{y}{q}\leq (A^pB^q-1)\sum_{i=1}^n a_ib_i.$$ Therefore it suffices to show, for any $i$, $$(AB^q-B)a_i^p+(BA^p-A)b_i^q\leq (A^pB^q-1)a_ib_i.$$ The difference LHS-RHS is a convex function of $a_i$ and $b_i$, hence we can assume that $a_i\in\{1,A\}$, $b_i\in\{1,B\}$. The inequality becomes an identity when exactly one of $a_i$ and $b_i$ equals 1, while in the other two cases it is equivalent to $$(1-A^{1-p})(1-B^{1-q})\leq(A-1)(B-1)\leq (A^p-A)(B^q-B).$$ By convexity again, $$1-A^{1-p}\leq(p-1)(A-1)\leq A^p-A,$$ $$1-B^{1-q}\leq(q-1)(B-1)\leq B^q-B,$$ whence the required inequality follows upon noting that $(p-1)(q-1)=1$.
sorry, it is not full proof, but too long for comment
By scaling argument, we may suppose $a_i\in [1,A]$, $b_i\in [1,B]$. Note that the difference LHS-RHS is convex function in each $a_i$ and $b_i$ (the function $f(x)=(x^p+M)^{1/p}$ for constants $M>0$ and $p>1$ is convex on $(0,\infty)$). Hence it maximum on a closed segment is attained on one of endpoints. So, without loss of generality $a_i\in \{1,A\}, b_i\in\{1,B\}$. Also, for fixed arrays of $a_i$'s and $b_i$'s the RHS is minimal if large $a$'s are coupled with small $b$'s. It reduces our problem to the 2-parametric problem: number of ones in arrays of $a_i$'s, $b_i$'s. I guess that in the optimal situation number of ones between $a_i$'s equals the number of $B$'s between $b_i$'s, but I do not see any clear proof.
It is less or more the same as GH's proof, but let me explain how may one naturally come to such argument even without a priori knowing the constant. I do not refer here to other comments.
At first, by standard scaling argument, $a_i\in [1,A]$, $b_i\in [1,B]$. Let's try to estimate $\sum a_ib_i$ from below via $\sum a_i^p$ and $\sum b_i^q$. The easiest way is by summing up inequalities $a_ib_i\geq \alpha a_i^p+\beta b_i^q$ for some positive constants $\alpha$, $\beta$. This inequality may be rewritten as $1\geq \alpha x+\beta x^{-q/p}$, where $x=a_i^{p-1}/b_i$. Since the RHS is convex in $x$, it suffices to check for maximal and minimal possible values of $x$, which corresponds to minimal $a_i$ and maximal $b_i$ or viceversa. In other words, we need to check two inequalities $B\geq \alpha+\beta B^q$, $A\geq \alpha A^p+\beta$, which correspond to pairs $(a_i,b_i)=(1,B)$ and $(a_i,b_i)=(A,1)$. It is natural to take $\alpha$, $\beta$ so that both inequalities are equalities. This is $2\times 2$ system, we solve it to find $\alpha=(AB^q-B)/(B^qA^p-1)$, $\beta=(BA^p-A)/(B^qA^p-1)$. Now it remains to get $$ \sum a_ib_i\geq \alpha\sum a_i^p+\beta\sum b_i^q\geq (\alpha p)^{1/p}(\beta q)^{1/q} (\sum a_i^p)^{1/p}(\sum b_i^q)^{1/q}.$$