Assuming independence of trials and that each trial has probability $p$ of success and also that $r=2$, as in the title:
$P[Y=k]$ is the probability that the second success occurred on the $k$'th trial. If the second success occurred on the $k$'th trial, then there was exactly one success in the first $k-1$ trials and the $k$'th trial was a success.
Now, there are $k-1$ ways to have exactly one success in the first $k-1$ trials (for example, one way is that the second trial was a success and the other $k-2$ trials were failures), each of which having probability $(1-p)^{k-2} p$. So the probability that exactly one success occurred in the first $k-1$ trials is
$\tag{1}P( \textstyle{\text{exactly one success}\atop\text{ in the first }k-1\text{ trials} } )=(k-1)(1-p)^{k-2}p.$
The probability of a success on the $k$'th trial is $ \tag{2}P( \textstyle{\text{ success on the}\atop k\text{'th trial} } ) =p$
The probability that the second success occurred on the $k$'th trial is the product of $(1)$ and $(2)$: $P[Y=k]=\bigl(\,(k-1)(1-p)^{k-2} p\,\bigr)\cdot p= (k-1)p^2(1-p)^{k-2}.$