auto mode there will be a threshold in terms of light level below which it will activate the flash.
Before reaching this threshold, the camera will try to adjust exposure using other means such as increasing aperture, increasing exposure time and increasing the effective ISO of the sensor.
Only once all these other measures reach their acceptable limits (wide open for aperture, a suitable maximum ISO, and say 1/60s or 1/30s for exposure time), then the Flash will activate.
Some cameras also have the ability to detect other situations where you may want to use the Flash such as strong backlighting, but there is a limit to how intelligent this can be.
The problem with this is that you probably often want to use the Flash when the camera hasn't reached the threshold for automatically enabling it. That's why there's an ability to manually override it.
For example, it's perfectly sane to want to use a Flash even when you would otherwise be able to get a 1/60s or 1/120s exposure: this is fast enough to hand-hold the camera, but not fast enough to capture human movement without your subjects being blurred. Thus, enabling flash will help freeze the action, assuming you are comfortable with the trade-off in appearance of using flash (on-camera flash can create harsh lighting appearance). You may also decide that the camera's boosting of ISO makes the noise too harsh - ultimately,
auto mode has decided on its own compromise between noise caused by boosting the ISO and the effect of flash, but since you are smarter than it, you may decide you want to override the camera's wisdom.
If you know whether you want the flash to be on, you wouldn't set it to
auto - you would put your camera in a mode that lets you control the things you want to control. The most basic of these modes is
P mode where, by default, everything is still controlled automatically, but it allows you to set various things, including the flash, to manual. This is usually accomplished with a button that physically flips the flash up, but it should also be confirmed with an icon in the viewfinder or on the back of the camera indicating the flash mode.
I'd encourage you to also experiment with other flash modes such as slow curtain flash, when your foreground subjects are in the dark but there are lights in the background. Experiment to find what works well.