system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Wars] How exactly do Jedi detect "danger"?

In Episode II, Obi-Wan and Anakin sense danger in Padmè's room and find two deadly worms in it.

In The Clone Wars episode "The Unknown", a Jedi Master senses a treacherous clone about to shoot her from behind.

How exactly do they detect this danger?

EDIT: To elaborate, I don't see how they can use the Force to detect something random going on.
gpt
Jedi have a vague and intuitive sense of the near future.

If they are about to feel pain, or acute stress, or get very startled, this will stand out to them from the near-future as clearly as if it were happening already. With practice and mindfulness, they can get ahead of the danger instead of just panicking early.

They also have the ability to sense thoughts and feelings, *especially* of people they share emotional bonds with. So if they, or somebody close to them, is going to go through some shit soon, they feel it early.