Similar to the link: Why I can't reduce an integral divided by another integral?
I caught a similar situation that looks like this question. I read the book named Advanced Calculus: a geometric view written by James J.Callahan. On page 74 of its section one Mean-value theorems of Chapter 3 Approximation, it has the context listed as the two following images screen-snapped.
When $$ m g(x) \leq f(x)g(x) \leq M g(x),$$ then $$ m \int_a^b{g(x)dx} \leq \int_a^b{f(x)g(x)dx} \leq M \int_a^b{g(x)dx},$$ It says both that all sides can be divided by $$ \int_a^b{g(x)dx},$$ then it becomes $$ m \leq \frac{\int_a^b{f(x)g(x)dx}}{\int_a^b{g(x)dx}} \leq M $$
If the expression in the middle becomes $f(c)$, then it is true that $$ m \leq f(c) \leq M ,$$ but it does not tell us how to becomes $$ f(c) \int_a^b{g(x)dx} $$.
How do we get the result from this type of integral dividing by another integral?



This is a direct consequence of the Intermediate value theorem, which states that
Your quotient of integrals, $\displaystyle {\frac{\int_a^b{f(x)g(x)dx}}{\int_a^b{g(x)dx}}}$, is a fixed finite number between m and M. The quotient plays the role of $u$ here. By the Intermediate Value Theorem, since f is continuous, there must exist some $c\in (a, b)$ such that $$f(c)=\displaystyle {\frac{\int_a^b{f(x)g(x)dx}}{\int_a^b{g(x)dx}}}\implies \int_a^bf(x)g(x)dx = f(c)\cdot \int_a^b g(x)dx$$
EDIT to address the comments:
First Comment: Yes and No.
There exists a $c_1\in(a, b)$ such that $$\int_a^bf(x)g(x)dx = f(c_1)g(c_1)(b-a).\tag{1}$$
There ALSO exists a $c_2\in(a, b)$ such that $$\int_a^bf(x)g(x)dx = f(c_2)\int_a^bg(x)dx.\tag{2}$$ However, there is no guarantee that $c_1 = c_2$, so your statement of the two above equations implying $\displaystyle\int_a^bg(x)dx = g(c)(b-a)$ is incorrect, because $f(c_1)$ and $f(c_2)$ will not cancel out.
HOWEVER, there does exist a $c_3\in(a,b)$ such that $$\displaystyle\int_a^bg(x)dx = g(c_3)(b-a)\tag{3},$$ but $c_3$ need not be equal to either $c_1$ or $c_2$, thus $(3)$ does not have any relation to $(1)$ or $(2)$.
Also, you can observe that the equation $\displaystyle \int_a^bf(x)dx = f(c)(b-a)$ is just a special case of $\displaystyle\int_a^bf(x)g(x)dx = f(c)g(c)(b-a)$, obtained by putting $g(x) = 1$, so that $\displaystyle\int_a^bg(x)dx = (b-a)$ and $g(c) = 1$ for any value of $c$.
Second comment: Naively, you can consider some sort of hierarchy: derivative $\rightarrow$ function $\rightarrow$ integral. Suppose F is the indefinite integral of f. Now if the LHS of the mean value theorem $f(b) - f(a) = f'(c)(b-a)$ is replaced with the antiderivative F of f, you can consider it going up a step, so you take the RHS up by one step, to get $\displaystyle \int_a^bf(x)dx = f(c)(b-a)$.
More formally, if you let the antiderivative of $f$ be $F$, then $F'(x) = f(x)$ and by the Mean Value Theorem on $F$, we get $$F(b) - F(a) = F'(c)(b-a)$$ but by using $F'(x) = f(x)$, we get $$F(b) - F(a) = f(c)(b-a).$$ Now by definition, $F(b) - F(a) =\displaystyle\int_a^bf(x)dx$ so we get $$\int_a^bf(x)dx = f(c)(b-a),$$ as desired.$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\blacksquare$