How do ions form?

from the gain of neutrons
from the gain or loss of protons
from the gain or loss of electrons
from the gain of protons
a?