The best way to get a good-looking sky in your game or simulation is to use Simul Weather. But those who have an interest in such things, and time to spare might like to try writing their own sky scattering model. The first place to go in this case is usually to the 1999 paper on scattering by Preetham et al., where the basics of Mie and Rayleigh scattering are outlined.
Scattering is the process that turns the sky blue – light passing through air is scattered away from its direction of travel. Blue light is scattered more than green and red, so the sky is blue, and distant objects acquire a blue cast. But any light that was travelling towards the viewer to begin with is also scattered – again, more blue than red and green – so distant clouds can appear yellow, and the sun at dawn appears red.
Implement the Preetham model and you’ll get the basics of a blue sky with a bright horizon. You’ll need to include both Mie and Rayleigh scattering to get the right effect, and some of the more obscure terms are necessary to get the right look for twilight – plain Rayleigh scattering turns the whole sky yellow at sunset, which is quite a common look in games, but practically unheard of in reality. You may also find that the horizon is too bright, and the zenith too dark, even in daylight.
The yellow twilight effect is actually not a failing of the model, so much as the “blue twilight effect” is an additional quality of the sky that can’t be modelled with single Rayleigh or Mie scattering alone. You need to bring in some of the more advanced properties of the atmosphere to get the correct, blue sky at twilight. The over-bright horizon, and dark zenith are much simpler to correct. It’s not your model that’s at fault, it’s your monitor.