Introduction
With seemingly every event in Pokemon GO, a new shiny (or several) is released into the wild, through research, or in raid battles. For many players, collecting shinies is the most fun and exciting aspect of the game, while others may focus on hunting a few particular shiny Pokemon (maybe their favorite species or favorite color). At one point or another, every shiny hunter has probably asked themselves the same question: How is it possible that after catching so many of these damn things, none of them have been shiny?
Of course, it’s random whether or not an encounter is shiny. The theory is that every shinyeligible species has a programmed “shiny rate” and each time you encounter that Pokemon, independently of all other encounters (though you’ve probably heard otherwise at some point), it’s shiny with this specific probability. While we’re not entirely sure what these shiny rates are, data from The Silph Road suggests that there are many different ones:

~1/450 for standard, common Pokemon

~1/24 for the featured Pokemon on its Community Day

~1/20 for legendaries from raids

~1/10 for 3hour “raid days”

Other, widelyvarying rates for less common Pokemon (Onix, Aerodactyl, etc.) and Pokemon with shiny rates boosted by events
With data about a Pokemon’s shiny rate, we may hope to answer the following question: How many do I need to encounter before I finally find a shiny? Unfortunately, there isn’t a satisfying answer here; theoretically, it’s possible to initiate any number of encounters without ever finding a shiny. However, we CAN do the math to answer this rephrased version of the question: How many do I need to encounter before I find a shiny with a certain probability?
The Math
If the shiny rate for a Pokemon is 1/r and we want to find at least one shiny with probability at least p, this will require at least n encounters, where:
It’s also important to note that waiting times are memoryless  you’re not more likely to catch a shiny Pokemon on your next encounter if your last 1000 encounters weren’t shiny. In fact, perhaps contrary to intuition, the expected number of encounters before you see your next shiny is always the reciprocal of the shiny rate, no matter how long it’s been since your last shiny encounter. While your probability of never having encountered a shiny (cumulative “bad luck”) goes down with every encounter, the amount of time you should expect to wait until you find one never goes down!
An Approximation
p  25%  50%  75%  90%  95%  99% 

encounters to find a shiny with probability p  0.29r  0.69r  1.39r  2.3r  3r  4.6r 
Other values are shown in the table above. This 95% threshold is often used in conjunction with statistical significance, and so it provides a sort of benchmark for what real “bad luck” actually is. The next time your friend complains that they still don’t have a shiny Pidgey, you can tell them their luck isn’t truly so bad until they’ve encountered 1350 of them (since the shiny release) all with red talons.
Finding Multiple Shinies
Of course, if you’re going for a living shiny dex, then for Pokemon that evolve, one shiny isn’t enough. We can ask (and answer) the same question: How many encounters do I need to get enough shinies to cover the whole family with a certain probability? It turns out that this number isn’t simply twice as many for two shinies as it is for one, or triple as many for three as for one, but also depends on the probability you pick. We’ll skip the math this time and go directly to the tables:
To test your own values of r and n, you can make a copy of this Google Sheet to see how lucky or unlucky you’ve been in your travels. Simply edit the yellow boxes and the sheet will compute the probability of having encountered a shiny for the numbers you provide.
How to Use This Information and Parting Words
With a bit of understanding about how these probabilities work, you can set catch goals for yourself for weeklong events with boosted shiny rates. If you suspect (or TSR reports) that the newest shiny release has a shiny rate of 1/150, take a screenshot of your Pokedex at the beginning of the event and set a goal for yourself. Think about the amount of time you’ll have to play and how many catches you can make in an hour. Maybe you want to catch 208 of them for a 75% of getting at least one shiny, or if it evolves, 252 for a 50% chance of getting at least two. At the end of the event, you can go back and compare your dex numbers from before and after and plug into the calculator to get a sense of how lucky you actually were.
This same methodology may be used to analyze waiting times for other ingame (and outofgame) phenomena. For example, how unlucky is it to not see a perfect lucky after fifty guaranteed lucky trades? All the same principles apply: plug the values r = 64 and n = 50 into the calculator, and the result is that you expect to encounter a 100% IV lucky with probability 54.5%  you’ve been unlucky, but not unreasonably so. If you think you’ve been unlucky not to hatch a Riolu from your Adventure Sync 10km eggs, use the value r = 6 and see how likely it is that you haven’t hatched one yet. Perfect legendaries appear with probability 1/216.
If you find yourself getting discouraged by your luck, take comfort in the fact that, given enough opportunities, you will eventually find what you’re looking for. It’s always fun to commiserate with others about the gaps in our collections (how do I STILL not have a shiny Growlithe?!), but putting some numbers behind it can help you set reasonable goals and expectations when your favorite shiny sees its debut in the next event.