Why do people ge excommunicated?
Presently? According to church articles contained in Ensign and other church publications, excommunications occur for personal reasons ranging from murder and espionage all the way down to apostasy.
It's the most extreme punishment of an LDS Disciplinary Council. Those are held by the bishopric unless it appears that the outcome may be the excommunication of a Melchizedek Priesthood holder, in which case they're held by the stake president. The uses of Disciplinary Councils is a subject much to broad to write about here and is something I'd suggest you research if you have the time. The LDS Ensign article on its use is found here
Informally, you would have to read the books, postings, and blogs of those who have been excommunicated, get an idea of the charges these excommunicants claim, and decide whether you believe those claims. Specific reasons for excommunication aren't made public.
Academically, some historians (particularly starting with members of the September Six) appear to have been excommunicated for publishing LDS history outside the boundaries of 'faithful history' as that term was made famous by Apostle Boyd K. Packer, although there is likely more involved in the interpersonal relations that led to those excommunications. Some of these authors include D.Michael Quinn, Ph.D., Avraham Gileadi, Paul Toscano, Lavina Fielding Anderson, Maxine Hanks, David Wright, Michael Barrett, Brent Metcalfe, Janice Allred, Margaret Toscano, and Shane LeGrande Whelan.