Connecting a potentiometer
A potentiometer is just a variable resistor:



-> The longer the "trace" from W to either A or B, the higher the resistance.


  1) What would happen if ground was switched with the output?
  2) Why do we need all three terminals? Can't I just use two of them?


In general nothing, a resistor has no polarity. However, it depends on how you intend to use it (connecting only two or all three terminals to essentially have two dependent resistors)