There are a few sort of groups of power origins in comics: Genetic from birth (e.g. mutants, aliens), granted/endowed by external means (e.g. Spider-Man, Fantastic Four), or learned/reliant on external means (e.g. Iron Man).
In many cases of powers being granted by external means, the specific circumstances often play a major role in the new power set and abilities. Spider-Man is bitten by a radioactive spider. Sandman comes into contact with irradiated sand.
Mutants seem to be entirely different. Their powers are based on the X gene, and typically manifest at puberty or in times of great stress.
We know that at least some related mutants end up with similar or related powersets (e.g. Cyclops and Havok, or Magneto and Polaris), so biology and genetics must play at least somewhat into a mutants powers.
What determines a mutant's abilities (why did Wolverine get claws and healing, but Kitty Pryde got phasing), and when is this determination made (at birth? at time of emergence?)