I almost saw someone die today...

Your question is vague and the answer and, at least for the United States, is state-dependent.

In California, we have things covered. There is a law on the books for pretty much everything. Why? Because, at some point, someone has 'been there and done that.' We're a large state and packed with many people, many of them inattentive and idiotic (whether doing their makeup with the visor mirror down on the freeway or walking across streets, texting, with their phone screen in their faces). Most of the laws regarding your inquiry fall under our state's vehicle code.

You can get pinched for jaywalking under our jaywalking laws if you step into the street anywhere other than a controlled intersection or a crosswalk. That pretty much covers everywhere.

VC 21955: Between adjacent intersections controlled by traffic control signal devices or by police officers, pedestrians shall not cross the roadway at any place except in a crosswalk.

When you're at an intersection, you must obey the lit signs that tell you to cross/wait/do not enter/etc. Crossing without an indication from the lit sign means, again, you're violating the vehicle code.

VC 21456(b): ... No pedestrian shall start to cross the roadway in the direction of the signal, but any pedestrian who has partially completed crossing shall proceed to a sidewalk or safety zone or otherwise leave the roadway while the "WAIT" or "DONT WALK" or approved "Upraised Hand" symbol is showing.

So, now we get to the question of pedestrian versus vehicle at an intersection that is not controlled by lights. Our vehicle code states that pedestrians have right of way over vehicles once they step into the crosswalk. Basically, whoever is there first owns it until - legally speaking - they have entirely cleared the intersection or crosswalk.

VC 21950(a): The driver of a vehicle shall yield the right-of-way to a pedestrian crossing the roadway within any marked crosswalk or within any unmarked crosswalk at an intersection ...

Lastly, if you're a pedestrian, you can't race someone to the side of a crosswalk, seeing who can get their first, making a driver slam on their brakes because you think that they shall in every case yield to a pedestrian. You have to be smart about it! The other half of the last code section cited goes as follows:

VC 21950(b): This section does not relieve a pedestrian from the duty of using due care for his or her safety. No pedestrian may suddenly leave a curb or other place of safety and walk or run into the path of a vehicle that is so close as to constitute an immediate hazard. No pedestrian may unnecessarily stop or delay traffic while in a marked or unmarked crosswalk.

So, there you have it. If it's at an intersection, it falls to the above. If it's anywhere else, you're technically jaywalking. Keep in mind that every one of these code sections has been passed into law because someone, at some point, did something that made people go, 'Hmm, we should do something about that so the next person doesn't get killed.' To answer a question, 'Is there a law?'

Yeah, I'd say so. I hope you found this informative. Let me know if you have any questions.

/r/AdviceAnimals Thread Parent Link - imgur.com