1. Any player in the game has 200+ current life (10 hearts).
2. A Shadow Orb has been broken
Goblin invasions can only occur once per week in game.
After the two criteria are met, Goblin Scouts will be on the surface approaching your original spawn point. After killing five of the scouts, you will get the on-screen message: "The Goblin Army is invading from the East/West!" This means that the Gobln Army is heading towards your spawn. They approach in waves and spawn immediately, so there is no break in the action until defeated.
There should be a total of 80 Goblins in the army. There is also and additional 40 goblins for each player in-game that has health of 200 or more.
Goblin Sorcerer: Most annoying unit in the Goblin Army. They can teleport, and can come inside your base even if the doors are blocked. Its Chaos Balls travel through blocks, so take them out first.
Goblin Thief: A quick-moving melee unit that comes straight at you, but cannot steal any items or take anything from your chests or base.
Goblin Peon: A regular melee unit. They are capable of breaking doors off (like a hammer). This can be prevented by blocking up the doorway with any block or a Tiki torch, just like during a Blood Moon where the Zombies can open doors.
Goblin Warrior: A heavy melee unit that approaches slower than other units but deal more damage and take more to kill.
Goblin Archer: Standard ranged unit that fire arrows (obviously) and stay at a distance when the other units move forward.
You can die as much as you want, but you do have to kill all of them before they go away.
The Goblin Army is unlimited until you have defeated the required amount. Once you hit that number, you get the message "The Goblin Army has been defeated!" and your achievement. Any remaining units can be killed or left alone like any other spawning creature.