You can also have a dwarf release animals or goblins without the use of a lever. Hit q and hover over the cage, then a to assign creatures to it. Things inside the cage will be at the top with a + next to them. You can release them by hitting enter, which removes the +, which is your designation that they should be inside the cage.
The goblins and non tame animals will try to escape or fight your dwarves if you don't open their cage with a lever from a room they can't escape with one exception. The exception is if the cage is built directly next to a pit that has marked the specific goblins for dropping into it. To make a pit, dig a channel, remove any ramps, then use the i (zone) menu to designate a pit. You can assign creatures to it just like a cage. Remember to build the cage before assigning them to the pit and not the other way around.
To remove a goblin's equipment, which is highly recommended when moving them around along with stationing armed guards in case it goes wrong, build the cage and then mark it with d>b>d. This marks everything, including the cage for dumping in your dump zone. Once everything is done and the goblin is naked and unarmed, you can remove the dump with d>b>D, and the cage won't go to the dump zone once it's deconstructed. If you want the dwarves to move the goblin's stuff to an appropriate stockpile, go to your dump zone and d a d>b>c on the pile of stuff there.
If I want to release goblins, I usually use mechanisms to link the cage to a lever. You can then wall the cage in and use the goblins as marksdwarf training for dwarves on higher ground or something.