Let
$$f(x)=a_n \ x^n+a_{n-1} \ x^{n-1}+\cdots+a_1 \ x+a_0$$
be a $n$-th degree polynomial with positive coefficients such that all of its roots are real. Choose any number terms from this expression ($a_nx^n$, $a_0$, etc, are called the "terms"), and define a polynomial by adding all these terms.
For example, the new polynomial $g(x)$ can be defined as,
$$g(x)=a_0+a_{n-5} \, x^{n-5}+a_2 \, x^2$$
Now the question(s) are this :
How many such total chosen polynomials will have all of their roots real?
(Determining if a solution can/can't be formed to this problem is also a question.)
Also, please note that this question came up when me and my friend were trying to create hard problems in number theory. I don't know whether if it is hard, but I do not really know where to begin than taking simpler cases of this problem and actually finding all possible function.
If a solution can be formed and it depends on more information about the constants or anything else, please choose and specify such conditions.
I actually don't know if a solution can be formed. I sincerely apologise for not showing any of my work, because I am not getting any ideas and I am just a high school student. Thank you for your time.
Notes
[The following has been copied directly from (a previous version of) this Math.SE answer by @Blue. (Check that answer for updates, including the recent reference to a related power series result by Hutchinson.)]
As per the question, we're starting with a real-rooted polynomial $$f(x)=\sum_{k=0}^na_k x^k \qquad a_k> 0 \tag1$$ and we're tasked with counting the real-rooted sub-polynomials (RRSPs) whose terms are chosen from those of $f(x)$.
(This partial answer only finds an upper bound, shown in $(3)$, on the count; also, if the stated Conjecture holds, then we can say that the upper bound is always attainable.)
Note that a polynomial with non-negative coefficients has no positive roots. So, the roots of any real-rooted sub-polynomial $g(x)$ must be negative or zero; thus such a polynomial has the form $a x^p \prod_{k=0}^{q-1}(x+r_k)$, for strictly positive $r_k$ (the negatives of the negative roots). Expanding the product, there's no chance of cancellation, so $g(x)$ has a term for each power of $x$ from $p$ to $p+q$, no skips; therefore, as a sub-polynomial of $f(x)$, any real-rooted $g(x)$ has the form $$\sum_{k=p}^{p+q}a_k x^k \qquad p\in\{0,\ldots,n\}, q\in\{0,\ldots,n-p\} \tag2$$ I call these consecutive-term sub-polynomials (CTSPs) of $f(x)$.
Including $(p,q)=(0,n)$ (ie, the original polynomial $f(x)$), and $(p,q)=(0,0)$ (the constant polynomial $g(x)=a_0$) the total number of CTSPs of a degree-$n$ polynomial is the triangular number $$\frac12(n+1)(n+2) \tag3$$
Any RRSP is necessarily a CTSP, but the converse is not true. Trivially (and by convention for the constant polynomial $g(x)=a_0$), any one- or two-term CTSP is an RRSP. After that, there are no guarantees. For example, all CTSPs of $x^3+4x^2+4x+1$ are real-rooted; however, as observed by @GregMartin, $x^3+4x^2+4x+c$ is real-rooted for $1<c\leq 32/27$, but its CTSP $4x^2+4x+c$ is not. Therefore, $(3)$ is an upper bound on the number of RRSPs for a given starting polynomial.
(A lower bound is $1+(n+1)+n=2(n+1)$, accounting for $f(x)$ itself (by assumption), and its one- and two-term CTSPs.)
Exactly counting RRSPs spawned a given polynomial without examining all of the CCSPs seems a daunting task. A more-manageable preliminary one may be to find conditions under which the count attains the upper bound. (I don't have any such conditions to offer here, only some examples of individual upper-bounding polynomials and a conjectured family.)
As a step towards that, we might compile specific instances. For instance, a quick-and-dirty Mathematica search found these quartics $$ x^4+\phantom{0}8x^3+\phantom{0}16x^2+\phantom{00}8x+\phantom{00}1 \\ x^4+43x^3+293x^2+477x+192 \\ x^4+37x^3+299x^2+590x+271$$ (Mathematica likely could've found plenty more. I had only asked for three instances of quartics for which the discriminants of its cubic and quadratic CTSPs are non-negative. I don't claim that's a sufficient condition in general, but it worked here.)
We could also seek families of polynomials, such as this possibility:
Conjecture. All CTSPs of $\;\sum_{k=0}^n \left(\frac{ax}{2^{k-1}}\right)^{k}\;$, with $a>0$, are real-rooted.
(The formula for $a_k$ arises by making the discriminants of all of the quadratic CTSPs vanish. Mathematica verifies the conjecture for various examples I've tested, but I simply haven't had time to attempt a proof.)
In particular, taking $a=2^{n-1}$, so that $a_k=2^{k(n-k)}$, gives a palindromic polynomial with this property; eg, $x^3+4x^2+4x+1$ and $x^4+8x^3+16x^2+8x+1$ mentioned earlier.