1. Out Run out
(a) Either batsman is out Run out, except as in 2 below, if at any time while the ball is in play (i) he is out of his ground and (ii) his wicket is fairly put down by the opposing side.
(b) (a) above shall apply even though No ball has been called and whether or not a run is being attempted, except in the circumstances of Law 39.3(b) (Not out Stumped).
2. Batsman not Run out
Notwithstanding 1 above, a batsman is not out Run out if
(a) he has been within his ground and has subsequently left it to avoid injury, when the wicket is put down.
(b) the ball has not subsequently been touched again by a fielder, after the bowler has entered his delivery stride, before the wicket is put down.
(c) the ball, having been played by the striker, or having come off his person, directly strikes a helmet worn by a fielder and without further contact with him or any other fielder rebounds directly on to the wicket. However, the ball remains in play and either batsman may be Run out in the circumstances of 1 above if a wicket is subsequently put down.
(d) he is out Stumped. See Law 39.1(b) (Out Stumped).
(e) he is out of his ground, not attempting a run and his wicket is fairly put down by the wicket-keeper without the intervention of another member of the fielding side, if No ball has been called. See Law 39.3(b) (Not out Stumped).
3. Which batsman is out
The batsman out in the circumstances of 1 above is the one whose ground is at the end where the wicket is put down. See Laws 2.8 (Transgression of the Laws by a batsman who has a runner) and 29.2 (Which is a batsman's ground).
4. Runs scored
If a batsman is dismissed Run out, the batting side shall score the runs completed before the dismissal, together with the penalty for a No ball or a Wide, if applicable. Other penalties to either side that may be awarded when the ball is dead shall also stand. See Law 42.17 (Penalty runs).
If, however, a striker with a runner is himself dismissed Run out, runs completed by the runner and the other batsman before the dismissal shall not be scored. The penalty for a No ball or a Wide and any other penalties to either side that may be awarded when the ball is dead shall stand. See Laws 2.8 (Transgression of the Laws by a batsman who has a runner) and 42.17(b) (Penalty runs).
5. Bowler does not get credit
The bowler does not get credit for the wicket.