Let's say you have a feeling something bad will happen. You go to the kitchen, pour yourself a glass of water, and walk back to your room. Then you accidentally drop the glass, it falls and breaks. Can you then say, "How I knew something bad would happen."? Or is there another phrase for it?
There are many phrases used to express a premonition or an antiipation particularly of something bad.
The sentence "How I knew something bad would happen." does not sound fully natural, however. Just remove the "How" to get:
I knew something bad would happen.
Or more strongly
I just knew something bad would happen.
In the form of a question one might say:
How did I know something bad would happen?
Why did I think something bad would happen?
Why aren't I surprised that something bad happened?
Or any of many other possible forms.