You use whoever to refer to someone when their identity is not yet known.
Whoever did this will sooner or later be caught and will be punished.
无论是谁干的,迟早都会被抓住并受到惩罚。
Whoever wins the election is going to have a tough job getting the economy back on its feet.
无论谁在选举中获胜都将面临复苏经济的的艰巨任务。
You use whoever to indicate that the actual identity of the person who does something will not affect a situation.
You can have whoever you like to visit you.
你可以见到你想见的人。
You use whoever in questions as an emphatic way of saying 'who', usually when you are surprised about something.
Whoever thought up that joke?
究竟是谁想出那个笑话的?