There are several factors that increase price. Some are related to the objective quality of the wine, some indirectly linked, other are rather disconnected from quality (but not necessarily irrelevant, as we'll see).
It's also worth noting that being of high quality doesn't necessarily mean being appealing to the average consumer.
Apart from the stuff listed below, mass-market wines tend to be made in a non-challenging, easily accessible style. Lower tannin levels, less acidity and a generous amount of residual sugar (say 10-30g/l) makes for easy quaffing but little complexity or elegance. They can be very well-made, but the agriculture may not be very sustainable, and the fruit probably isn't of the highest quality. (If you visit a winery at harvest when they bring in the bulk wine fruit, the meaning of "quality" becomes rather apparent.)
Wines targeted at connoisseurs, wine snobs and wine geeks (such as yours truly) tend have more structure (tannins, acidity) and are more often completely dry (although there are of course high-quality off-dry, semi-sweet, and sweet wines).
There's a limit to how much a producer can spend to increase quality, a limit which varies with location (because of salaries for workers etc) but around $100 per bottle is probably in the right order of magnitude. This does not mean that all wines above this magical limit are equally good, though.
A dirt-cheap wine will also have a cost associated to it which will be payed for by someone else, like under-payed harvest workers, the environment around the vineyard, etc.
Below are some factors that have a more or less direct link to wine quality and/or character:
Yield per acre: Limiting the vineyard's yield per acre (which can be achieved by sparser planting, thinning/green harvest, old vines, etc) increases the quality of the fruit, but you will produce less wine with more or less the same amount of work, which means you'll have to adjust the price.
Number of harvesting tries: At harvest, you can pick all the fruit of one vineyard at the same time and be done with it. Unfortunately, not all bunches ripen at exactly the same time, so to avoid over- or under-ripe grapes, you can make multiple tries (French, pronounced "trees") over several days and pick each bunch at optimal ripeness. More tries inevitably means more work, and so, price increases.
Selection: When the harvest is brought in, you can throw all the fruit into the press, or you can select the best grapes to make your wine (and make brandy or a second wine of the discarded grapes, or sell them on to a bulk wine producer). Being picky reduces the amount of wine produced, and so, prices increase.
Drying: Some wines, like Amarone and straw wine, are made from partially dried grapes, and drying decreases the amount of wine you produce (apart from being extra work) which means - more expensive wine.
Sparkling: Sparkling wines made with the traditional method - like Champagne and Cava - need to be disgorged after bottle fermentation, which leads to a certain amount of waste (a Cava producer I talked to said that around 10% of the original wine is lost in disgorgement).
Oak aging: Many wines are fermented and/or aged in oak barrels, which greatly affects the character of the wine compared to other types of containers, like concrete or stainless steel vats. (More oak doesn't mean better wine, of course.) Oak barrels are horribly more expensive than the alternatives (and European oak is more expensive than American, and they impart different character), and so, the more oak you use, the more expensive the wine gets.
Aging in general: Most high-quality wine receive a bit of aging before consumption to let all components integrate; some designations of origin even require aging prior to selling. Rioja Gran Reserva, for example, must be aged at least three years, with at least one of those years being on oak, while vintage Champagne is mandated to rest three years on the lees, etc. Apart from time being money, you also need a suitable storage location (cool and humid but not too cool and humid, secure but accessible to yourself, etc) which is far from free. The price increases.
Other factors aren't causally linked to higher quality, but tend to be connected:
Reputation: If you're an unproven winemaker you will be able to charge more if you're operating in a district of high repute than if you're working in an area where no-one has made quality wine before. Conversely, a well-known, high-quality producer expanding their operations to a somewhat less proven district will likely be able to charge more than their new neighbours.
Brand: Marketing can take many forms, such as it advertising, tailoring wines to suit influential reviewers, and tends to push prices up. Wineries can even try increasing prices just to seem more exclusive. You can also be lucky and find some great, undiscovered producer (don't tell anyone! except me, that is) selling their wines at more-or-less cost price (which probably still won't be dirt cheap, though).
Land prices: Some spots are better for growing grapes. If you're in unexploited territory, you might find a great spot and pay next to nothing, but if you're in a region with an established wine industry, odds are all the good spots are taken... and it'll cost you to buy an existing vineyard.
Know-how: Making wine is hard. Unless you are good at it yourself (or a friend, or perhaps your nephew, or your sister-in-law, is), you can hire some hotshot consultant œnologist like Michel Rolland to help you make the most of the fruit you produce... but the consultants will cost you lots of $$$, and your customers will need to pay.
Vintage: Vintages vary in quality and quantity. If a vintage is high quality but low in quantity, we will see less supply and likely higher demand. Having said that, a good year isn't always a guarantee for a good wine (if the winemaker screws up the quality of the fruit doesn't matter), and in a hard year, auspicious microclimates and competent vintners can produce great wines anyway. Furthermore, some years can be very good but have an even better "sibling" year, and don't receive their due hype. For example, 1995 was a very, very good year in Champagne, but 1996 is perhaps one of the greatest vintages evur, so the 1995s can be something of a bargain compared to 1996s.
Some things might not increase quality at all but still have an effect on price (and some of these may still be worth the price!):
Use of pesticides: Using pesticides to counter disease, parasites, pests, etc can increase yield without affecting quality negatively, which lowers the price, but on the other hand you spew out poisons into nature and expose your vineyard workers to them. (The residues left in the finished wine tend to be negligible, though.)
Labour: Paying decent wages to your harvest workers means a costlier wine. Find some illegal immigrants you can pay less than minimum wage and the wine gets cheaper.
Taxes: Some countries have different alcohol taxes for for different ABVs. For example, in Sweden (where I live) the tax is relatively lower for a 15% ABV wine than it is at 16% ABV (which isn't very common, but for example Zinfandels and Amarones can reach that amount). Furthermore, in some countries the alcohol tax depends on the alcohol content solely (which favours expensive wine, as alcohol tax will end up being rather negligible), in others it may be a percentage of the retail price (which favours cheap wine).
Price regulations: At least historically, some districts have regulated the minimum price (and sometimes also the maximum) price a farmer can charge for their fruit when selling it to a winemaker, which inevitably affects the end price.
Export/import: If you buy wine from far away countries, not only are you paying for the transport, but you may also be paying import/export tariffs.
Organic certification: Organic farming doesn't necessarily mean organic certification. The organizations issuing certifications charge a fee, which can be quite hefty for a small producer, so some organic producers aren't labelled as such since they can't afford the certification fees.
Adding gold: Yup, there are wines with actual gold added to them. I can't see that affecting quality in any way, but it'll surely affect the price!
So, to conclude - quality costs, but not all costs impart quality, and quality doesn't equate appeal.