What if a ball runs a wicket and hits another ball lying just beyond?

The key to answering a question about what to do when two events occur on the same shot is to focus on the concept of “the first thing that happens usually dictates the result.” In this case, you have earned one extra shot for making the wicket, and hitting the other ball is ignored. That is because the first thing to happen was clearing the wicket, not hitting the other ball. Since you have made the wicket, you are now live on all the balls, including the one that you hit after you cleared the wicket. You may choose to roquet (hit) that ball again on the continuation shot to earn two extra shots, but you aren’t required to do so. The answer is the same even if you hit the other ball before your ball had fully cleared the wicket. That is because you begin to score the wicket when part of your ball exits the wicket on the non-playing side (or back side). In this example, the first thing that happened was that you began the process of scoring the wicket. As long as your ball scores the wicket (your ball isn’t showing on the playing side of the wicket) after hitting the other ball, you still get just one shot for making the wicket and become live on all the other balls, including the one you hit after you began to score the wicket.

Blue is about to attempt the wicket.

Blue has started scoring the wicket and has just hit red.

Blue has scored the wicket. Even though blue hit red, because it had started scoring the wicket first, the wicket counts and the hit is ignored.