A sufficient sample space for your experiment could be $\Omega = \Bbb N \times \{0,1\}^\infty$, the Cartesian product of the natural numbers and an indefinite series of Bernoulli outcomes. It's not necessarily the only one that could describe the experiment, but is it a usefull one since you can clearly see how the random variables of interest would map from it. (Another viable sample space would be $\{0\}\cup\Bbb R^+$, though this is somewhat less than obvious (it has to do with expressing the fraction part in base 2).)
Who really cares? All we require is there is that there is some probability space that can be measured by the random variables such that their probability mass functions are as described.
Now, we require the random variable $N$ to map $\Omega\mapsto\Bbb N$ such that the probability measure gives the result: $$\mathsf P(N^{-1}\{n\})~=~\dfrac{\lambda^n e^{-\lambda}}{n!}~\mathbf 1_{n\in\Bbb N}$$
Where $\forall n\in\Bbb N:N^{-1}\{n\}=\{\omega\in\Omega\mid N\{\omega\}=n\}$.
Although we more often write this as simply:$$\mathsf P(N=n)~=~\dfrac{\lambda^n e^{-\lambda}}{n!}~\mathbf 1_{n\in\Bbb N}$$
Also, the series of random variables $(X_i)_{i\in\Bbb N^+}$ maps $\Omega\mapsto \{0,1\}$ and the (same) probability measure must be such that for all $i\in\Bbb N^+$ we have: $$\mathsf P(X_i^{-1}\{0\})~=~1-p~,~ \mathsf P(X_i^{-1}\{1\})=p$$
Aka:
$$\mathsf P(X_i=x) ~=~ p~\mathbf 1_{x=1}+(1-p)~\mathbf 1_{x=0}$$
Then we can define the random variable $S:\Omega\mapsto\Bbb N$ via $\forall \omega\in\Omega~:~S\{\omega\}=\sum_{i=1}^{N\{\omega\}} X_i\{\omega\}$
Which is usually abbreviated as $S=\sum_{i=1}^{N} X_i$
And without reference to $\Omega$, whatever it may be, we can show that, due to mutual independence of $(N, X_1, X_2, ...)$, and the identicality of $(X_i)$:
$$\mathsf P(S=s) = \sum_{n=s}^\infty \mathsf P(N=n)\binom n s \mathsf P(X_i=1)^s \mathsf P(X_i=0)^{(n-s)}~\mathbf 1_{s\in \Bbb N}$$
Which simplifies to a rather familiar expression.