Drunk man with a set of keys. I found this problem in a contest of years ago, but I'm not very good at probability, so I prefer to see how you do it:

A man gets drunk half of the days of a month. To open his house, he has a set of keys with $5$ keys that are all very similar, and only one key lets him enter his house. Even when he arrives sober he doesn't know which key is the correct one, so he tries them one by one until he chooses the correct key. When he's drunk, he also tries the keys one by one, but he can't distinguish which keys he has tried before, so he may repeat the same key.
One day we saw that he opened the door on his third try.
What is the probability that he was drunk that day?


I'll do it for the case where the man has $k$ keys and gets the correct key on the $j$th try. Essentially, we're trying to find
$$P(\text{Drunk|$j ^{th}$ attempt successful})$$
By Bayes' Theorem,
$$P(\text{Drunk|$j ^{th}$ attempt successful}) = \frac{P(\text{Drunk $\cap$ $j ^{th}$ attempt successful})}{P(\text{$j ^{th}$ attempt successful})}$$
Let's find the denominator first. We can do this with the Law of Total Probability
$$P(\text{$j ^{th}$ attempt successful}) = P(\text{$j ^{th}$ attempt successful|Drunk})P(\text{Drunk}) + P(\text{$j ^{th}$ attempt successful|Sober})P(\text{Sober})$$
We are told that he comes home drunk about half the time, so $P(\text{Drunk}) = \frac{1}{2}$ and $P(\text{Sober}) = \frac{1}{2}$.
We also know that when drunk he has the chance to repeat keys and when sober he tries the keys without repetition, so
$$P(\text{$j ^{th}$ attempt successful|Drunk}) = P(\text{$j$ attempts with repetition}) \\ = \left( \frac{k-1}{k}\right)^{j-1}\frac{1}{k}  \\ (\text{Because  we get the wrong key $j-1$ times and then the right key}) $$
$$P(\text{$j ^{th}$ attempt successful|Sober}) = P(\text{$j$ attempts without repetition}) = \frac{1}{k}$$
Putting this together:$$P(\text{$j ^{th}$ attempt successful}) = \left( \left( \frac{k-1}{k}\right)^{j-1}\frac{1}{k}   \right)\left( \frac{1}{2} \right) + \left( \frac{1}{k} \right) \left( \frac{1}{2} \right) \\ = \left( \frac{1}{2} \right)\left[ \left( \frac{k-1}{k}\right)^{j-1}\frac{1}{k}    + \left( \frac{1}{k} \right)\right]$$
Now all that's left is the numerator which we've honestly already done a lot of the work for $$P(\text{Drunk $\cap$ $j ^{th}$ attempt successful}) = P(\text{$j ^{th}$ attempt successful|Drunk})P(\text{Drunk}) \\ \text{(This is the first term in our law of total probability equation)} \\ = \left( \frac{1}{2} \right) \left( \frac{k-1}{k} \right)^{j-1}\frac{1}{k}  $$
Altogether now we have:
$$P(\text{Drunk|$j ^{th}$ attempt successful}) = \frac {{\left( \frac{1}{2} \right) \left( \frac{k-1}{k} \right)^{j-1}\frac{1}{k}}}{\left( \frac{1}{2} \right)\left[ \left( \frac{k-1}{k}\right)^{j-1}\frac{1}{k}    + \left( \frac{1}{k} \right)\right]} \\ = \frac{\left( \frac{k -1 }{k} \right)^{j-1}}{1 + \left( \frac{k -1 }{k} \right)^{j-1} }$$
If you substitute in the numbers you have, you should end up with $\frac{16}{41} = \overline{.39024}$
