This question can be broken down into a few parts:
What causes the irritation?
If your ears become irritated from wearing earrings you are experiencing a contact allergic reaction to the earrings. Contact allergies (also known as contact dermatitis) occur when your body is in contact with a reactive substance. These allergies develop over an extended period of time while your immune system is developing a response to these reactive substances. Once your immune system has developed a response, you will start experiencing a reaction when that substance is present.
So, you can wear earrings made with reactive metals for years without a reaction or irritation while your body builds a response. Then all of a sudden, your body will start reacting to those substances after just a brief encounter with them.
Why does it only happen to some people?
Some people have more sensitive skin and therefore are more susceptible to contact allergies. Some people may have had more exposure to the irritant so they built up an immunity faster.
Why does it only happen with some earrings?
The difference is in the metal or other material that the earrings are made from. There are numerous metals that are highly reactive with the human body and very likely to cause contact allergies. These metals include nickel, cobalt, copper, chromium, iron, zinc and more. Jewelry companies frequently use metal alloys that contain these metals to make their earrings. Jewelry companies will label their earrings things like "hypoallergenic" or "nickel free" but those terms do not account for all of the possible metals that could cause irritation or reactions.
What earrings are safe?
Pure titanium, niobium, platinum, and some gold alloys are the safest metals for earrings. These metals are non-reactive with the human body. It is very important that they be pure or alloyed for biocompatiblity otherwise they could still contain small percentages of reactive metals that will react with your body.