Construction took centuries, and soft ground beneath it made the tower lean — today it is one of Italy's top attractions.