murgatroid99 did an excellent job of explaining how the cookies appear, so I'm going to skip that part.
Using the source code for the current version (v.1.0375), I sat down and calculated the actual odds a bit more exactly.
When you click on a cookie, the game generates a list of possible outcomes for that cookie; certain outcomes are less likely to appear than others. Once this list is generated, each outcome on the list has an equal probability of being chosen.
The descriptions below are the normal effects; if you have the Get lucky upgrade, the time-based effects will have double duration.
For a golden cookie:
- 100% Frenzy (7x cookies/second for 77 seconds)
- 100% Lucky (get 13 cookies and 10% of total cookies or 20 minutes worth of production, whichever is lower)
- 10% Click Frenzy (clicks worth 777x normal for 13 seconds)
If you have earned at least 100,000 cookies in total:
- 1% Chain Cookie (get 6 cookies and 10 times whatever the previous cookie in the chain was worth; new cookie will spawn in 3 seconds if chain continues)
For a wrath cookie (red grandmapocalypse cookies):
- 100% Clot (cookies/second halved for 66 seconds)
- 100% Lucky
- 100% Ruin (lose 13 cookies and 5% of total cookies or 10 minutes worth of production, whichever is lower)
- 30% Chain Cookie/Elder Frenzy (666x cookies/second for 6 seconds)
- 10% Click Frenzy
- 0.7% Chain Cookie (actually 1%, but only if the previous 30% chance for Chain Cookie/Elder Frenzy failed)
When the grandmatriarchs are awoken/displeased/angered, 33/66/100% of cookies will be wrath cookies.
This results in these probabilities for a cookie having a specific set of possible outcomes:
Golden cookies:
- 89.1% Frenzy/Lucky
- 09.9% Frenzy/Lucky/Click Frenzy
- 00.9% Frenzy/Lucky/Chain Cookie
- 00.1% Frenzy/Lucky/Click Frenzy/Chain Cookie
Wrath cookies:
- 62.559% Clot/Lucky/Ruin
- 27.000% Clot/Lucky/Ruin/Chain Cookie/Elder Frenzy
- 06.951% Clot/Lucky/Ruin/Click Frenzy
- 03.000% Clot/Lucky/Ruin/Chain Cookie/Elder Frenzy/Click Frenzy
- 00.441% Clot/Lucky/Ruin/Chain Cookie
- 00.049% Clot/Lucky/Ruin/Click Frenzy/Chain Cookie
To determine the odds of a given outcome, divide each of these probabilities with the number of outcomes in that set, and add together the numbers where that option appears. Rounded to 3 decimals, that gives the following odds:
Golden cookie:
- 48.175% Frenzy (89.1%/2 + 9.9%/3 + 0.9%/3 + 0.1%/4)
- 48.175% Lucky
- 03.325% Click Frenzy
- 00.325% Chain Cookie
Wrath cookie:
- 28.611% Clot
- 28.611% Lucky
- 28.611% Ruin
- 06.020% Chain Cookie
- 05.900% Elder Frenzy
- 02.248% Click Frenzy
However, it's a bit more complicated in practice.
There is an 80% probability that the most recent golden cookie effect is removed from the list of possible outcomes. To determine the probabilities for a cookie given the most recent effect, you would need to adjust the probabilities for the possible sets of outcomes accordingly.
As an example, suppose that the most recent effect was Lucky, and a Golden Cookie appears; this cookie then has the following probabilities for the sets of outcomes:
- 71.28% Frenzy
- 17.82% Frenzy/Lucky
- 07.92% Frenzy/Click Frenzy
- 01.98% Frenzy/Lucky/Click Frenzy
- 00.72% Frenzy/Chain Cookie
- 00.18% Frenzy/Lucky/Chain Cookie
- 00.08% Frenzy/Click Frenzy/Chain Cookie
- 00.02% Frenzy/Lucky/Click Frenzy/Chain Cookie
which results in these odds for the individual outcomes:
- 85.262% Frenzy
- 09.635% Lucky
- 04.652% Click Frenzy
- 00.452% Chain Cookie
(Calculating the odds given another previous outcome is left as an exercise for the reader.)