Goblins normally follow their squad captain, if he is alive, unless there's a dwarf within about 20 squares. Squad captains normally charge your base if they can find a path, trapped or not, to a dwarf, and their squads follow. (Note: the previous answer is incorrect; goblins are just as omniscient as you are, except they can't see traps.) However, a known bug right now is that goblins with flying mounts sometimes get confused and have a hard time pathing; this especially affects captains because they're mounted more often than the normal troops. If the captain's mount is confused, his squaddies will just stand around guarding him, rather than attacking on their own. This is similar to the problem that causes attackers to hang around your entrance rather than heading farther in: their captain is caught in a cage trap, but he's not dead so they just stand around rather than leaving him behind.
How to diagnose this: First, find the goblin captain on the units screen. He's the one marked "Elite" or "Master", and he'll probably have a different weapon from his squaddies. Zoom to the creature, and see if he's inexplicably floating above the world, especially if he's above a tree or something. If so, you'll have to order the militia out there, because that's the only way you're going to get rid of them; and you'll have to gain some height so that your marksdwarves can shoot at the captain, remembering that they can't shoot upward. You might have to build a small tower nearby to arrange this. An goblin master bowman stuck atop a tree with no higher ground nearby is a deadly threat, almost impossible to get rid of, because he shoots any of your masons who try to build a tower for the marksdwarves to stand on (and master bowmen are ridiculously dangerous).
If the captain's just parked on the ground, with his buddies, and not attacking you, something else is wrong: probably there isn't actually any way into your fortress. Check the doors; besieging goblins won't path through locked doors or raised drawbridges. Trolls path TO these obstacles because they're building destroyers and they like to destroy them, but goblins care only for dwarves. So go ahead and open the gates. Just make sure the militia is standing behind, and your civilians are burrow-restricted not to go outside, &c.