I believe a major factor is the experience students have while studying. Certain universities are very good at creating a sense of loyalty, community, and attachment which endures after students graduate.
For example, in the UK, Oxford and Cambridge receive disproportionately more donations than other universities. 41% of all alumni donations in 2013-2014 went to Oxbridge. There are also a large number of named chairs. Historically Oxbridge students have had a strong loyalty to their college and are keen to give back once they are alumni. This loyalty is built through many means, such as the links to tradition, virtually all undergraduates living together in their college. There is a lot of inter-college rivalry in sport, academics, who has the best may balls, etc.
While I have never been to university in the USA, I would imagine that a similar loyalty exists in Universities which receive a lot of donations. For example, College sports in the United States, in particular (American) football and basketball, have a very large following and people are very loyal to their team. For example the University of Michigan has the largest Football stadium in the USA (107,601 seats) and is also in the top ten in terms of endowment ($10.06 billion). Could this simply be a coincidence?
Some universities take a more utilitarian approach. With more students commuting to classes, fewer sports facilities, etc. In this case the education process could seem more like purchasing a service. Not that it would necessarily detract from the quality of the degree/education, but it would not instill the same sense of attachment which would lead an alumni to donate. I would suspect that universities structured in this way would rely more heavily on government funding and attempt to keep costs down by reducing the non-essentials.