|This article is about an older version of DF.|
Losing is fun!
Either way, it keeps you busy.
Unless you mine too much adamantine, there is no internal end point or single goal or final Easter egg or "You Win!" announcement in Dwarf Fortress. Therefore, eventually, almost every fortress will fall. The only ones that don't tend to be very conservative and very boring - and what fun is that? Therefore, DF = losing, losing = fun, DF = losing = fun, and that's okay! It's a game philosophy, so embrace it, own it, and have fun with it!
Most new players will lose their first few forts earlier than later;
if when you lose a fortress, don't feel like you don't understand the game. Dwarf Fortress has a steep difficulty curve (often described as a "cliff"), and part of the process (and fun!) is discovering things for yourself. However, this Wiki serves as an excellent place to speed up the learning process.
Various common things can cause the death of a fortress. Let's examine some together...
 Local Wildlife
Goblins aren't the only creatures that want you dead. The obvious threats aside, some creatures with benign names or descriptions can be surprisingly deadly. Be it wolves, rhesus macaques, or (gulp) elephants, a sudden wildlife attack can quickly cripple or destroy an unprepared fortress. Before you unpause a new game for the first time, hit nits, and scroll down to see what's sharing your map. Learn to do this regularly - new creatures will frequently migrate onto your map and then off again to be replaced by others.
Consider arming up and thinning out any predictable threats, which can also help avoid the next problem...
 No Food
A serious danger, generally in the more inhospitable climates, is the loss of your dwarves due to starvation. As dwarves begin to starve, they will become Hungry, then Starving. This will cause them first to slow down all work, and then to become very unhappy. When they die, their friends will become upset and will become even more unhappy, potentially causing the remainder of your fortress to break out in a terminal hissy fit.
Don't forget your alternative sources of food. If your farms aren't doing the job and a trade caravan is months away, try butchering your domestic animals, gathering plants, or resorting to hunting of local wildlife.
 No Booze
As long as you have a well or access to the cave river, your dwarves should never be in any danger of dying of thirst. However, dwarves require alcohol to be happy and productive. Some alcohol can be acquired from caravans, but not enough for an entire fort until the next caravan arrives. You must farm plants to then brew those in a still with an empty barrel - it's just part of being a dwarf.
 Flooding accidents
Careless usage of floodgates and channels, especially when attempting to irrigate a farm plot, can potentially flood large sections of your fortress with water, causing anybody in the area to drown. Using doors to seal off various areas can help (and placing guard channels can be invaluable), but allowing a flood to pour into the cave river will render it permanent unless you can manage to trigger a cave-in.
Attempting to harvest the power of magma as a weapon (i.e. flooding the world with it) can backfire spectacularly if the floodgates are not kept safe from building destroyers (such as fire men), potentially incinerating your entire population. Unlike with water, recovering from a magma flood can be nigh impossible.
 Inability to mine (aka "no picks")
Simply put, you need picks to mine ore, which is then smelted to make metal for items like more picks. If you are careless (or ignorant) of how to dig safely, and your miners create a collapse or flood and their equipment gets lost/destroyed/unrecoverable, and you have no materials to make more picks, you will be at a severe handicap until the problem is solved. Any dwarf can be given the mining labor, but without a pick they can do nothing. There is no way to get new metals or stone for any purpose nor any way to dig new rooms/tunnels unless you have picks.
If you have bars of weapons-grade metal (or the equivalent ores) and a forge (and smelter if you need one), you can create new picks and continue. You can also request additional picks from your outpost liaison, who will arrive with the next dwarven trade caravan in a year. Or you can abandon and try again.
Averting this fate is simple: stockpile at least one additional pick at the first possible opportunity, or some of the raw material to make more, and keep them away from current digging operations.
See also: Making your own weapons
 General Unhappiness
If there is little in a fortress to give your dwarves happy thoughts and enough to give them unhappy thoughts, then your dwarves will start to throw tantrums, grow melancholy, and/or cause general chaos. In extreme (and, sadly, quite common) cases, this can lead to a tantrum spiral and the loss of the entire fortress. Unhappiness is more likely to occur if your fortress is suffering other kinds of downfall, so try to keep all the bases covered.
Sieges can be quite devastating to a fortress, but unlike most of the other ways of losing they are unlikely to occur early on, even if you do something stupid to piss off another civilization.
Should hosts of goblins besiege your gates and drive your peasantry inside, trolls beat down your doors and force you to seal off from the outside world, you may have already lost the game. Even if you have built an utterly impenetrable fortress with drawbridges and moats, siegers may stick around for a long time. Although a dwarven fortress can be made self-contained, with crops, metal and fuel readily available, underground wood source and your own livestock, a fortress may not sustain such a state indefinitely. For example, trade with the outside world has now been shut off, leaving you only what ores are on your map for the production of mandate goods. In the long run even those will run out. This can result in a breakdown of social order if you do not prevent your Hammerer from killing or maiming your dwarves. Shell, bone, and leather commonly acquired by hunting and fishing need to be supplied by previously established livestock and the cave river. If these resources are no longer available to your workers, moody craftsdwarves will be driven into suicide or worse. Rotten vermin corpses begin to heap in your food supply, generating miasma, forcing you to dump these into the chasm and risk disturbing its residents.
With all these critical industries unproductive, dwarves dying, and friends mourning over the rotting heaps of slain loved ones, it's important to remember your dwarves have nothing to do but throw funeral receptions, grief counseling sessions, and the occasional keg stand. This means they've all become one big happy family of friends, manically depressed from the loss of any dwarf.
In short, the attacking army can simply wait until your dwarves emo themselves to death.
The goblins may not be your only enemy; remember that time you accidentally tried to trade wooden goods to that elf trader? Well, it turns out they got pretty annoyed - prepare for an elven war! It may only take a simple accident to start a war you can't possibly win. War is especially difficult to overcome when your fort is taking its first steps, but it is easy to prevent unless you really hate elves- or humans (but then you have other serious problems, dude). Once the goblins discover you, they will automatically be at war with you, so there's no escaping from them - other wars will be denoted in-game on the ivilization screen. (NOTE: You cannot be at war with your own race, so no epic dwarf showdowns.)