Normally lens flare is something to be avoided in your shots. However there are times it can used to create creative photos if used properly.
First you need a light source to create the lens flare. If using the sun it works best if it’s low in the sky. Next make sure your feature object partly obscures the light source to reduce the glare.
To get the correct exposure you will need to to dial in an exposure adjustment. This is because the camera will meter the scene and under expose the shot due to the strong light source. You will need +1 or higher for correct exposure.
The type of flare will be influenced by the lens and aperture selected. As a rule of thumb start with a wide aperture of f/4 or f/5.6 with a focal length of 40mm to 100mm.