There were at least two reasons why it was not easy to unify Italy. One of the reasons was internal to Italy while the other was external.
The external reason was that there were foreign countries who had interests in the Italian peninsula. It was not simply a matter of getting various Italian states to agree to unify. Instead, there were the French and the Austrians to contend with. Both of these powers had interests in Italy and had to be dealt with in the course of the move to unify.
The internal reason is that there was a strong sense of regionalism in what is now Italy. Even today, there is a great deal of animosity between the northern and the southern parts of Italy. In the 1860s and 1870s there was even more. Many Italians were more accustomed to thinking of themselves as citizens of a given small state, not as ethnic Italians. This made them less likely to be interested in becoming part of a larger Italian state.
For these two main reasons, it was hard to unify Italy.
The fact that the Pope controlled his own areas within ununified Italy undoubtedly compounded the process of forming a nation-state; who within Italy would invade the Papal States and risk excommunication? However, after France, although Catholic but a foreign power, began taking over Italian areas, such reservations lessened. Solidifying Italian resolve to throw out the French gave rise to the beginnings of Italian Nationalism, which unified the country, and eventually began Italy's acquisition of colonies. Curiously, Germany went through an almost identical process of unification culminating in the 1860's; their "late" unification and expansion brought them into conflict with the "early" unifiers (France & England) which was a factor in both World Wars.
I cannot speak with any great authority on modern history but I can say that as far back as Roman times regional identity was very strong in Italy and it took a savage civil war in the early first century BC to bring all Italians into Roman citizenship. This regional identity obviously reasserted itself following the fall of the Roman Empire and Italy was a collection of independent states right down to Napoleonic times and then the process of unification as a single Italian state took place in the 19th century. Even today regional and even language identity remains pronounced in Italy, so it is perhaps no great surprise that unification was a difficult process despite apparent geographical unity.