…other than obvious – sword, bow, punching.
For example, the wiki has an entry on Zombie Pigman:
Rare drops
2.5% chance to drop a gold ingot if killed by a player
8.5% chance to drop their golden sword when their death is registered as a player kill.
The chances of each can be increased by 1% per level of Looting.Experience
Zombie pigmen drop 5 experience (12 if baby), when their death is registered as a player kill.
I know there exist pigmen-based XP farms that don't involve the player attacking any pigmen directly. So what sort of deaths count as 'player kill' for the purpose of loot/XP drop? – at least from the more common/practical ones… I'm well aware there are hundreds of ways one can kill a mob.
(if you have the extra knowledge about how these affect pigmen hostility; in particular if any drop XP but don't make zombie pigmen hostile, that would be a nice addition to the answer.)
Best Answer
Migrated and adjusted my answer from a more specific question to this more general one.
XP and "rare drops" drop if the mob is killed by any action that the game considers "killed by player" or if it dies up to three seconds later.
These actions are:
Also, due to the bug MC-56653, angry pigmen always drop XP and rare drops. This is commonly used in gold farms.
What doesn't count as a player kill:
Knowing these actions is really helpful if you want to kill villagers without lowering your village reputation, pigmen and wolves without angering the pack, endermen without angering them or any other mob without increasing your kill statistic (for example in Adventure maps that use that statistic).