A ball bounces because it is elastic. As it hits a surface it pushes back and the surface also pushes it away, following Sir Isaac Newton's law of motion that states that with every action, there is an equal and opposite reaction.
Different balls bounce differently because of the materials they are made from. When a ball is in motion, gravity acts upon the ball, giving it kinetic energy. When the ball hits an object, the kinetic energy has to be displaced in some way. This displaced energy causes the ball to become deformed. The act of reforming back into the ball shape is what gives the ball its bounce, and its material make-up is what makes the reformation and bounce stronger or weaker.