Number of Bernoulli trials to first success, with changing $p$ [A version of this question was previously posted by another user, but the OP deleted rather than edit the question into a more suitable form for routine textbook work. I am reposting in the hope of attracting an answer that was outlined there,]
Suppose $X_1 \sim \text{Bernoulli}(p_1),... , X_n \sim \text{Bernoulli}(p_n)$. 
If a realization of $X_1$ is a success, stop. Otherwise, get a realization of $X_2$. Continue on in this manner until a success is observed, cycling back around to success probability $p_1$ when necessary (i.e. if the first $n$ trials were all failures). 
Let $Y$ be a random variable representing the number of trials until a success.
Can anyone offer guidance and hints toward finding the pmf of $Y$?
 A: We all come in contact with a special case of this distribution when going Bernoulli $\rightarrow$ Geometric distribution. 
The Bernoulli distribution is the realization of an event $X_k=1$ with  $\Pr(X_k=1)=\theta$. The Geometric distribution $Y$ is the realization of $y-1$  non-events and $1$ event, all iid trials i.e 
$$\Pr(Y= y)=\Pr(X_1=\ldots X_{y-1}=0\cap X_y=1)$$
This should be enough of a hint. 
edit2: after @Glen_b's comment
In general, any positive random variable $Y$ and in particular the discrete ones (Poisson, Geometric, Rayleigh, Weibull) can be seen as a sequence of independent (but not identically) distributed Bernoulli trials, a sequence of non-events followed by an event. Set $\Pr(X_t=1)=\theta_t$ and see that
$$\Pr(Y=y)=\theta_y\prod_{t=1}^{y-1}(1-\theta_t)$$
Sidenote
To factor any positive distribution $T\in[0,\infty)$ we can write its survival function as $S(t)=1-F(t)=e^{-\Lambda(t)}$ where 
\begin{align}
\Lambda(0)&=0\\
\Lambda(\infty)&=\infty\\
\frac{d}{dt}\Lambda(t)&=\lambda(t)\geq 0\\
\end{align}
And note that the probability of event within $s$ steps from $t$ is
\begin{align}
F(t,s)&=Pr(T\leq t+s|T>t) \\
&=\frac{\Pr(T\in[t,t+s))}{Pr(T>t)}\\ 
&=\frac{S(t)-S(t+s)}{S(t)} \\
&= 1-e^{-(\Lambda(t+s)-\Lambda(t))}=1-e^{-R(t,s)}
\end{align}
This is called the Conditional Excess Cumulative Distribution Function. In particular, using a steplength of $1$ we have $R(t,1)=d(t)$ and we may write 
\begin{align}
\theta_t&=1-e^{-d(t)}\\
\Pr(T\in[y,y+1))&=\theta_y\prod_{t=1}^{y-1}(1-\theta_t)= e^{-d(y)}-e^{-d(y+1)}
\end{align}
