It all ties down to money in the end.
Anime costs money to make and sell. A company will sign a deal with the manga artist (and manga company/magazine) for one or two seasons these days, in which they have to take what the artist has done and slap it into 13, 26, or 52 episodes. If it wont all fit, they cut back on major things, water it down as a whole, or take out entire plot elements. If it's too small, they throw in filler episodes.
Sometimes they sign a deal early on when the manga is starting out, and when the episodes catch up to the artist, either fillers are made or the anime as a whole stalls and, in Japan, loses television time.
If an anime stalls for too long of a period, the department's present direction will be dropped in favor of other animes that will bring in money. If it doesn't sell brilliantly at the get-go, same thing will happen. And if the anime gets to a certain point (like 26 or 52 episodes), decisions will be made that the anime has lived a good life and needs to be put down, so an order is made by the company to rush out an ending. These endings are done on the moment (because the creators thought the series was going to continue all that time) and therefore end up rather sloppy.
Sometimes an anime does well in the beginning, is bought out for a few more seasons, those seasons end up rather terrible, and an ending is thrown out on the fly to just get it out the door. You know, fast enough so the company can go on to better, more pleasant ventures.
Hunter X Hunter is a good example. Four seasons were originally made of the series. On the forth season, the anime caught up to the manga and it stalled. The company doing the anime threw together a haphazard, confused, half-way-through-an-arc ending that was rather terrible now that I think about it... And then it was dropped in favor of other projects. Later on, as more HunterXHunter mangas came out, another company bought up the anime rights and released an OVA - which continues on after the 4th series.
This isn't even bringing up the manga companies as a whole and their hyper standards of getting things pumped out as quickly as possible to the distress of the artists. Sometimes mangas get lost, or are put on hold to do other, bigger money-making projects.