Why does electron affinity decrease with increase in size, and why does it increase with increase in nuclear charge?
Here's why that happens.
Electron affinity is defined as the energy given off when one mole of atoms in the gaseous state each takes in one (or more) electrons to become a mole of anions in the gaseous state.
Simply put, electron affinity tells you what the energetic gain is when an atom becomes an anion.
Now, let's take a look at the two factors you've mentioned and see how they affect electron affinity.
You can think of an atom's electron affinity as a measure of the attraction that exists between the nucleus, which is positively charged, and the electron, which is negatively charged.
This implies that factors that tend to reduce this attraction will also reduce electron affinity.
An increase in atomic size leads to a decrease in electron affinity because the incoming electron is added further away from the nucleus, i.e. on a higher energy level.
As you go down a group, the outermost electrons are located further and further away from the nucleus. This implies that they feel less pull coming from the nucleus. (Screening plays an important role here, too).
If this is the case, the gain in energy when an electron is added to the atom will not be as significant
On the other hand, an increase in effective nuclear charge has the exact opposite effect.
The effective nuclear charge is a measure of the pull exerted on the electrons by the nucleus. In essence, it relates to an increase in atomic number, i.e. the number of protons in the nucleus, that's unbalanced by an increase in atomic size.
When you add more protons to the nucleus, it will attract electrons more. If those electrons are added at the same distance from this increasingly powerful nucleus, then they will "feel" more and more pull from it.
When you go across a period of the periodic table, atomic number increases, but electrons are being added to the same energy level.
This means that an incoming electron will be more attracted to the nucleus, which implies that the energy gain when it is added to the atom will be more significant
That is why the periodic trend in electron affinity looks the way it does.
Now, don't be tricked by the negative sign! A more negative energy per mole means that more energy is given off when the atom adds an electron, so electron affinity increases!