On the top right hand side of the camera, there's a big rotary dial, it's called the ''MODE DIAL''. Make sure this dial is set to '''AUTO'''.
In '''AUTO''' mode, the camera will do all the exposure settings automatically, including raising the flash when necessary, so any picture you take will be exposed (more or less) correctly.
If you want learn how to use the camera and decide the settings yourself, I recommend you read the camera's manual. If you don't have it, the English version is available from [http://downloadcenter.nikonimglib.com/en/products/24/D5200.html|here] in pdf format. Note that the page lists both an ''user's manual'' and a ''reference manual''. The ''user's manual'' is best for beginners, while the ''reference manual'' is intended for advanced users who want to know all the details.