# Trying to apply Jensen's inequality to a complicated symbolic expression

I have a somewhat complicated inequality expression like this:

ineq =                         i * Log[n/i] +
Log[r[i, 0]] +
(n - i) * Log[(n*(1 - Subscript[p, 0]))/(n - i)] +
Sum[(n - i)*Binomial[i, k] * Log[1 - Subscript[p, k]], {k, 1, i}] > 0


I would like to bound it be Jensen's inequality: $$\log\left(\frac{\sum a_i x_i}{\sum a_i}\right) \ge \frac{\sum a_i \log(x_i)}{\sum a_i}$$. Yes, I make sure, that always $$a_i >0$$, in this case 0 < i < n. So first I need to compute the normalization constant, in this case it is:

z = i + 1 + (n - i) + Sum[(n - i)*Binomial[i, k], {k, 1, i}]


So, how can I compute this z in this symbolic case when the $$a_i$$ can be 1 or a Sum like here?

Then I suppose I would get the desired bound by:

ApplySides[#/z&, ineq]
With[{lhs = %[[1]]},
Log[lhs /. Log -> Identity] >= lhs
]


So basically my question reduces to: how to compute this normalization constant symbolically?

JensenCoef[a_ Log[b_]] := a