The number one shoe related mistake people make when they starting to lift weights is using normal running/exercise sneakers with a thick padded sole, this is kind of like trying to squat on a mattress. These shoes will limit your stability and strength and prevent you from performing exercises with correct technique. The less material there is between your foot and the floor, the more stability and control you will have whilst lifting weights.
The sole of your gym shoes should be incompressible for maximum power transfer through the floor. Shoes with a slight heel will make it easier to perform olympic lifts and deep squats, overhead squats and power cleans but may make deadlifts slightly more difficult. Since the majority of people will be focusing on back squats and deadlifts rather than olympic lifts, flat shoes should a better all round choice for the majority. Running and calf raises can also be difficult in olympic lifting shoes which is a major disadvantage if you can only own one pair of shoes for the gym.