Some are to lighten the hammer for target/competition guns and then some are there so the hammer can be big enough to cock with a thumb without being too heavy.
The Beretta 92 Elite has a skeleton hammer that gets pushed by a normal hammer spring. If you change the hammer spring to a "D" spring or "double action only" spring you must use the Elite II hammer that looks the same but is slightly heavier, otherwise you run the risk of light primer strikes.
Any hammer with less mass will move faster than its solid counterpart, but go too light and there will not be enough mass to transfer the correct amount of energy to the firing pin. Go with too light of a spring and you get the same risk.
Triggers with holes do tend to feel lighter with less bounce than the steel counter part...at least in 1911s. I can feel the difference between an aluminum trigger and a steel trigger and prefer the aluminum with or without the lightening cuts/holes
Many people get them for looks. Some think they do nothing ,but they change the characteristic and feel of the trigger or hammer if correctly set-up.