I have always been battling with those times (sunset/sunrise) of the day to make good pics. Either I have a dark foreground and then the sunset behing it or I have a foreground which you can see, but then the sky disappear into a blare.
What do I do wrong or how do I solve it?

I must say I use auto most of the time, because I'm not that schooled in photography. Here you can see clearly that some part of the pic is too dark. This one is not of a sunset or sunrise, just one of those dark days.
















A few samples never hurt. I took these a few weeks ago, in Botswana. OK Botswana sunsets are great anyway, so I have the advantage on you, but the principle is the same