Heres how all these terms came about for the same part.
3way - Counting only the Input, Out A, Out B.
4way - Standard pneumatic method: Input, Out A, Out B, Exhaust
5way - Counts Input, Out A, Out B, Exhast for OA, Exhaust for OB.
To answer your question on how they work heres small picture:
Thats how 95% of these types of switches work.
For a single acting, spring return cylinder you could either get a true 3way switch (In, OutA, OutB) or simply plug one port of a 4way.