Several different methods depending on what you have.
The most simple and the result that is often achieved without always being what the photographer wants, is the result of how macro shots are taken when using flash lighting. Typically when shooting macro handheld and when its alive (like an insect) is many push for a small aperture, for the depth of field; a low ISO and a fast handholding shutter speed.
eg f13, ISO 100, 1/200sec
Now in many situations if you just set the camera manually to that value and take a shot without any flash, chances are in most cases you'll get a totally underexposed (black) shot or one so close that there is no details to be restored and a slight contrast and exposure/blacks adjustment (in RAW) pushes it into pure black.
Now if we bring in flash the flash itself provides enough light on the subject to illuminate it for the camera - however light itself reduces exponentially from its source - so it very quickly weakens as it goes further from the flash. Thus if you've a flower in average light with flash lighting the flower and a decently long distance between the flower and its background then the flash light will never reach the background in enough quantity to give it details and you'll get your well lit subject and a black background.
The other approach is to use a black sheet of material held behind the subject so that its outside of the depth of field and thus rendered pure black with no details to record (this can be used in many colours and if oft a method used by photographers who want to avoid the pure black background effect - by using other colours such as greens or browns)