You're asking a huge question really but using flash comes down to two basic methods.
1 Using it as the main or sole source of illumination.
2 Using flash as fill in with the prevailing ambient light.
Method 2 produces the best results if your camera will allow you to do it. Meter for the ambient light first and then use those settings for your flash shot. It doesn't matter if you're using a very slow shutter speed - the technique is often referred to as 'Slow Flash Sync'
Using Method 1 is the default method for all point and shoot type cameras - the camera just selects flash when light levels drop below a certain level. The result is usually those awful 'deer in the headlights' type night out shots you see with dark backgrounds behind the subjects.
Flash is very linear -it goes out from the flash, hits the subject, bounces back to the camera, into the lens, and the onboard flash sensor quenches the flash when it deems exposure to be correct. In your shot it looks like the lighter skin tones have caused the flash to quench long before the darker hair was sufficiently exposed.
Limited as they are - built in flashes are usually well integrated with the camera exposure system and produce good results within their limited range Try metering for the available light in the room where you are now. use AV mode. It will obviously be a fairly slow exposure. THEN WHEN YOU'VE DONE THAT pop up the flash and take the shot. You should get a far more balanced looking shot.