"At first I wanted to run, but then I realized that if someone wanted to kill me, they would just burst in." or"At first I wanted to run, but then I realized if someone wanted to kill me, they would just burst in." If they are both correct which one would be better? If they are both wrong what can I use instead?
I've never been clear on when 'that' is considered grammatically appropriate in cases like this, if I'm being honest (and trying to google gets mostly 'that vs which' discussions), so I can't cite any rules, but I think the first sentence reads better.
I believe that (heh) the "that" is perfectly correct. I perceive its removal as mildly incorrect. But I know that many people advocate for a ruthless assassination of all such "thats".
I think either is correct, slightly prefer the first one, but would almost certainly rewrite the sentence to get rid of the filter words anyway. ie. "At first I wanted to run, but if someone wanted to kill me, they would just burst in."
The use of 'that' in this context is quickly falling out of fashion. It's deemed redundant and I'm inclined to agree. I also don't think you need the second comma either, but @Tenderiser is the person to ask on that front.
I feel like it depends on the character's voice. If they're a bit more formal and you want to display that aspect of their character, you can use: "At first I wanted to run, but then I realized that if someone wanted to kill me, they would just burst in." If they aren't as formal (or drop the formality because they're in a terse, dire situation), then you might use: "At first I wanted to run, but then I realized if someone wanted to kill me, they would just burst in." When writing in the first person, voice becomes much more natural to manipulate and convey, so I would use whichever one fits the character best. You could go even more truncated to reflect the fact that danger is afoot and shorten the sentence even further while still keeping the meaning, such as with: "I wanted to run, but if someone wanted to kill me, they'd just burst in." While there's certainly a single most grammatically correct choice, favoring a character's voice that reflects their situation (without compromising readability to the point that the reader can't understand you) can feel like the better choice depending on the effect you're trying to go for.