earthquake while on Space Mountain, but I've told that story already.) so I'm going to stick with what I know and explain to you how an evacuation from Space Mountain works.
First, you have to stop. There's generally two reasons that you'll be stopped on Space Mountain. One is that there's a backup of cars at the loading station. This usually occurs when a group of 10 or 12 people come through the line together and all want to ride in the same car, but they have a specific seating arrangement in mind that they want the ride attendant to guess. If you get stopped for this reason, you'll just sit in the dark for a few seconds while the poor ride attendant tries to explain to the group that if they want to ride together, all 12 of them won't be able to sit in the front row. Once the laws of physics have been explained to them, you'll be back under way with no real inconvenience.
If they can't get you started again right away, an attendant will come around to check on everybody and let you know that they're working on the problem. At this point, you'll notice that while most people think it's kind of cool to be stuck on a ride, there's always somebody who didn't really want to be on Space Mountain anyways, and they're convinced that the only possible reason for the ride to be stuck is that somebody has been killed. Most of the time I just feel sorry for these people and try to reassure them, but sometimes they just carry on way too much. In that case, it's fun to shake the car just a little and ask "What was that?" over and over again. Hey, I came to Disneyland for my entertainment, not yours.
Now for the most important part, compensation. The attendant will walk you to the exit corridor and point the way out. They have to go back and evacuate another car (unless you were riding with me, then you know you're the last one out) so go and find the attendants who work the loading/unloading station. Explain that you got evacuated from the ride and ask for a return fastpass so that you can come back when the ride is fixed. They don't have access to normal fastpasses at the ride station, but they do have a few special "apology" passes which are valid for up to six people for any ride in the park (except Nemo) including rides that aren't set up to accept fastpasses. They don't always have enough of these passes for everybody, so sometimes they hand them out without having to ask for them, and sometimes they don't. Make sure you ask for yours.
Now you just have to figure out what to use your pass on. Most people take it somewhere like Indiana Jones or Splash Mountain, but I like to use it somewhere that I can't get a normal fastpass for. Like Dumbo. You get very few chances to cut to the front of the line for Dumbo. Of course, then you're stuck riding flying elephants around in a circle, but you've probably achieved the maximum benefit of breaking down on Space Mountain.