The trick to balancing ambient light with your flash is to think of these two types of light as two separate exposures that can be controlled with different settings on your camera. That means it really helps if you understand how your camera controls affect different types of lighting, so we'll start there.
What are the three exposure controls that affect an ambient exposure? You can adjust the ISO, the shutter speed or the aperture and you'll see differences in the ambient exposure, right? But, did you know that only two of those controls have an effect on the flash exposure? It's true. Changes to the ISO or the aperture will change the way the flash exposure registers on the sensor, but changing the shutter speed will not. This is the key to balancing flash with ambient light: understand that shutter speed only affects the ambient exposure, not the flash.
Because changes to the shutter speed affect only the ambient illumination, you can use the shutter speed to bring in more ambient light, or to make it less prominent, without affecting the flash's illumination of the subject. Pretty cool, huh? Can you see where this is going?
You can go about balancing flash and ambient exposures in two ways, but I like to work in manual exposure mode for each. This is especially helpful while you're learning, because working in manual mode will eventually lead to an understanding of exactly how certain camera controls affect the image. And that's certainly helpful when trying to balance two sources of illumination. The first approach could be considered the "brute force" method, because you're going to simply slow the shutter speed from a normal flash-lit scene to introduce ambient exposure. It works, but sometimes the affects are a little unrefined.
For instance, let's say you're lowlight at ISO 400 and a shutter speed of 1/125th, at an aperture of f/8. With a flash on your camera (or better yet, a flash positioned off camera for more interesting lighting) this kind of exposure is likely to produce a usable photograph of a subject well-illuminated by the flash. (Whether the flash is controlled manually or via TTL metering doesn't matter. That said, I find manually adjusting the power of my flash to be a great way to take control of the output and make sure it's the same every time. It might also be a helpful way to wrap your head around controlling every exposure element manually.) Let's say your flash is putting out enough light at half power to produce a nicely illuminated subject with an ISO of 400, and shutter speed and aperture combo of 1/125th at f/8. If you changed the aperture to f/5.6, the subject would get brighter—and so would the background. If you moved to f/11, the subject would get darker, as would the background. So, changing the f/stop affects ambient and flash simultaneously, amounting to no change in their ratio. The same thing applies to the ISO: its changes affect all types of lighting equally.
But, what if you stayed at f/8 adjusted the shutter speed? Change the shutter speed from 1/125th to 1/60th and you'll see the background get brighter. (If it's imperceptible, you'll simply need to make a bigger change in shutter speeds before you start seeing the ambience appear.) Slow the shutter speed again to 1/30 and it's another full stop brighter. 1/15th is brighter still, and so on. All the while, you'll notice that the flash exposure on the subject remains the same—because the shutter speed has no effect on flash exposure.
It's the actual brightness of the ambient light that will dictate the correct exposure, of course. The point being that simply creating a correct flash exposure and then slowing the shutter speed until the ambient light registers is one way to balance flash with ambience. This "brute force" approach definitely works, but I prefer approaching the problem from the other direction by starting with the ideal ambient exposure.
Instead of working backwards from a correct strobe exposure, why not start with the perfect ambient exposure? That doesn't necessarily mean you need the subject to be brightly illuminated by the ambience; after all, you're working in low light so the overall scene should probably still be fairly dark. But this approach allows you to create the ideal ambient exposure for your scene. Maybe it's simply a twilight sky filled with color—and then add flash to the subject in order to create the perfect balance.
The main advantage to this approach is that you can boost the ISO enough to keep the shutter speeds fast enough and aperture wide enough to still have a hand-holdable exposure. The higher the ISO and the smaller the f/number, the lower you'll need to set the flash power. That's why I prefer this approach: a little bit of flash fill goes a very long way.
Let's say you're making a portrait at sunset. And let's say after a bit of trial and error you reach an ideal exposure for the ambient background of ISO 800, 1/30th of a second at f/4. Now all you need to do is add your flash to illuminate the subject. With the flash in auto TTL mode, it's going to add a fairly low-power flash—which you could dial in manually by choosing your flash's lowest output and adding power as needed. If you can't get the flash to a low enough setting, simply move it farther from the subject. If for some reason you can't get enough power out of it, simply move it closer.
If you're feeling overwhelmed by the details in this technique, remember that it all boils down to one key element: that flash exposure isn't affected by changes to the shutter speed, but the ambient exposure is. Balancing the two exposures in the same shot is a simple function of understanding your camera controls and putting them to work deliberately.
Lastly, bear in mind that the more ambient light is falling directly on the subject, the trickier it will be to separate the subject from the background. Ideally the ambient light will be isolated to the background, and the subject is essentially a silhouette. This way the longer shutter speeds needed to up the ambient value won't also up the ambient light on the subject; they will remain in shadow until you fill them in with a flash. Also, if you choose a setting in which there is some light in the background (like a sunset sky or the lights on Las Vegas boulevard) it can be much easier to practice the principles—both because it takes less of an exposure to create an appropriate background, and because it can be much easier to position your subject in a silhouetted situation.