Animals Asia (www.animalsasia.org) is a relatively small charity dedicated to ending bear bile farming, and runs Chengdu Bear Rescue Centre, where I am now.
Bear bile is used in traditional Chinese medicine as a cooling medicine, for fevers and liver problems and suchlike. They used to hunt bears and take the gall bladder, but this (together with habitat loss) decimated the wild population, so in the 80s they came up with farming bears for their bile.
Mostly they use Asiatic black bears (moon bears), sometimes sun bears and grizzlys.
Farming involves creating a hole from the gall bladder to the skin. Stainless steel or latex catheters are used, and sometimes the latex ones are run under the skin to exit on the thigh to make collection easier. Some bears wear permanent metal jackets housing a bag to collect the bile, and are anaesthetised (usually with ketamine) every month or so to empty it. The only legal method now is the "free drip", where a fistula is created so that bile can exit through the skin. Some Chinese pro-farming papers describe this as a sphincter mechanism "like the anus", but, no, it's just a hole. They have to be "milked" by placing a tube into the hole once or twice a day or the hole closes over. There are a number of "fake free drips" where the catheters are very short and hidden.
The surgeries are not aseptic, no pain relief is given, and they usually have to be performed repeatedly to open up a hole that has closed. The survival rates for the surgeries aren't properly documented but preliminary studies suggest they're pretty abysmal, something like 65-75%.
The bears are kept in very small cages, sometimes crush cages all the time, and often kept hungry to stimulate bile production.

(Franzi's old cage.)
Seeing the state of them is kind of upsetting. Many have arthritis and limb deformities because of the cramped conditions. Many of them display stereotypy and rock backwards and forwards, bite the cage bars until their teeth wear down or self-mutilate. Sometimes they've been declawed or had teeth pulled out. The poor nutrition causes an array of problems. The gall bladder areas are always a huge mess. In fact, the state the bile is in, with infections and white blood cells, I'm not at all sure it's a safe product to market for human consumption. There's also a high rate of liver cancers, abscesses, peritonitis from leaking bile...

(bear arriving at the centre)
None of this has stopped people poaching wild bears, of course. The farms stimulated demand, the entire gall bladders are worth more than ever and most farms supplement their captive-bred bears with illegally-snared wild bears (many of them admit it openly if asked, and a fair number of bears have snare scars or are missing limbs).
Chengdu Bear Rescue has permission from the government here in Sichuan province to acquire 500 bears. Sichuan province is not giving out any more licenses, so the charity buys bears at market price from farmers who are shutting down their farms. They rehabilitate them slowly and keep them in a rather impressive zoo-like setting, in carefully chosen groups with outdoor and indoor enclosures and a massive environmental enrichment program to keep
them from getting bored and stereotyping.

(Stardust and Mandela playing, that's Claudia watching them.)
There are an estimated 7000 farmed bears in Asia at the moment. The Chinese government is rather touchy about the subject since the EU roundly condemned bear farming this year.
The active compound in the bile, ursodeoxycholic acid, can be synthesised relatively easily without using any bears at all.