They do it because the thrill is worth the risk to them. Realistic risk assessment may also not be a forté of every drunk tourist who joins in.
If you are asking for the origin of the customary bull run, it's a tradition stemming from the time when the bulls were chased to the bull fighting arena by drovers and by members of the butchers' guild.
I lived in Southern Spain in the late 70's and used to attend this, um, celebration. It seemed to be the thing to do (at the time). Growing up on a farm, I had a bit more sense than to get out and run with them...
Ahhh, but there's a lot of liquid courage consumed at these events....
It was actually quite a good time.
We now return you to your regularly-scheduled program
The tradition of messing around with bulls goes way back. There was an ancient Greek activity in which men would run at the bulls and leap over their heads, turn flips over their backs and whatnot.
Running with the bulls in Spain is no more weird than cowboys trying to ride them, or roping young calves, etc.
I ran with the bulls( well, bull) once, completely unintentionally, having irritated one while cutting through a pasture between my granpa's place and my uncle's. Pretty...exhilarating, especially since I didn't get caught.