there are 3 types of liver biopsies:
1) the most common one is the one where the doc will take a needle and jab your liver with it, removing liver tissue in the process. multiple samples can be taken (mutiple jabs) to ensure they get a good picture of what is going on with the liver since damage may not be homogeneous.
2) laparoscopic biopsy. the doc inserts a tube through the abdomen which can be used to image the liver and ultimately remove tissue.
3) transvenous biopsy. in this one, the doc will put a catheter through a vein in the neck that leads to the liver. through this tube, material can be removed. this one is usually done when there's blood-clotting problems or fluid in the abdomen (ascites).
in all cases, the liver material is assayed for liver enzymes, amount of fat, scarring, etc.
there are some inherent risks and complications (such as infection, or knicking the gallbladder or lung) but these are pretty rare. generally the whole procedure takes ~20mins (freezing plus the actual biopsy) with a 1-2hr recovery.