Assume that $N$ and $X_1, X_2, \ldots $ are all independent and identically distributed over $(0,1)$ with the density function: $f (x) = cx^2 (1 − x)^2$.
An integer–valued random variable, $N$ specifies a random sum of first $(N + 1)$ variables, $$\sum_{j=1}^{N+1}x_j$$
We assume, for integer values of $k$, that $N$ is distributed as:
$$P [N = n] = (1 − p) p^k$$
I want to find the first and second moments of $Z$.
So, first, I integrated $f(x)$ over $(0,1)$ to solve for $c$ and recovered that $c=30$. So, we have:
$$f(x)=30x^2(1-x)^2.$$
My textbook doesn't really provide a method for doing this for a random sum. I understand the standard approach for just one variable, where
$$E[X^k]=\int_0^1 x^kf(x) \, dx$$
However, I don't understand how this relates to the method for a random sum. I also need to repeat this process for when $N$ is Poisson, so I'd really appreciate a clear step-by-step process for how to calculate this. Very much appreciated.
From your previous question, you know how to do this if you know $\mathsf E(Z\mid N)$ and $\mathsf {Var}(Z\mid N)$
So: $\mathsf E(Z\mid N) = \sum\limits_{i=1}^{N+1} \mathsf E(X_i)$ By linearity of Expectation.
Similarly: $\mathsf E(Z^2\mid N) =\mathsf E\Big(\big(\sum\limits_{i=1}^{N+1} X_i\big)^2\Big) = \raise{1.5ex}\mathop{\sum\limits_{i=1}^{N+1}\sum\limits_{j=1}^{N+1}}_{j\neq i}\mathsf E(X_i)\mathsf E(X_j)+\sum\limits_{i=1}^{N+1}\mathsf E(X_i^2)$ by that and the iid distribution of $\{X_i\}$.
Where : $\displaystyle\mathsf E(X_i)=\int_0^1 30x^3(1-x)^2\operatorname d x \\ \displaystyle \mathsf E(X_i^2)=\int_0^1 30 x^4(1-x)^2\operatorname d x$