First, when you line up before a class, it's butt to the rail unless otherwise specified. When you set up for inspection, generally you move straight toward the judge, so you stop head-on. Again, this is unless otherwise specified. I had one pattern where you had to stop at the cone, and the judge was to the side. After you're done with your pattern, you move to the rail. It really helps if you let someone else go first, so you have a point of reference. But there are two ways to go. Sometimes you line up on the rail where you started out. In that case, you line up so that if the class were to run again, it would be in the same order. (Does that make sense?) Other times you line up close to where the pattern ends. Just put your horse next in line, or have a ring steward direct you. In any case, this is also butt to the rail.
Okay, so I think that might have answered the first three questions.
At local shows, when you place you leave the arena. If your number didn't get called, you leave when they stop placing. But no matter what, keep showing until you are outside the pen.
A lot of times, you can ask the judge(s) a question before the class starts if something is not clear to you. And if you do have to pass the judge and (s)he is standing in front of you, pivot your horse until you have a clear path and then walk on.