When you get home and find your house a complete mess when you left it pristine in the morning before leaving, that is an example of when you could say "what the hell?"
An example of when you might say "what the hell" is when your wife asks if you will please go to her second cousins wedding. You might not want to, but you could say "what the hell, I'll go along."
It’s expensive, but what the hell, you only live once.
What the hell is going on?