“怎么会有这样的事情?”
In everyday street language (as if speaking with a friend):
No way!! How?
More formal:
"How would there be such a thing?"
Generally, you may say any exclamation, then ask your question, "How?"
Example:
That is awesome!! [Informal] How does it work? [Formal or informal]
She knew calculus at age 3?! (“居然可以这样做!is implied and need not be said/verbalized) [Formal or informal]
The following is okay to say in any occasion.
“怎么会有这样的念头?”
What?? [Immediately followed by] Why?
“居然可以这样做!
How did this happen?