A lot of the time, an anime adaptation is made when the manga reaches peak popularity, not when it finishes. So they anime makers run out of manga to base it on, and since a manga chapter takes a lot longer than an anime episode to make, they have a choice to make.
They can add a bunch of useless filler while they wait for a buffer to build up. Fans hate this because it takes a story that should have filled 2-3 seasons of anime and forces it to extend to hundreds of episodes, most of which do nothing to advance the plot, develop character, or anything else useful, and are written by somebody who doesn't understand what made it great in the first place.
They can split off into their own alternate story, like the first FMA did. Tends to lead to a broken fanbase, requires a good writer for both projects, and assorted other difficulties, but if you do it right you end up with two great (if only slightly related) stories.
They can leave the last episode on a to-be-continued and hope to get renewed in a few years. This has an unfortunately high chance of turning that non-ending into the last episode ever.
Or, they can decide to not deal with any of that, and tack a couple episodes on the end that have nothing to do with the real story, were written by somebody who may or may not have watched the whole series thus far, and try to tie up all the plot threads that have come up so far as quickly and incomprehensibly as possible. This is, unfortunately, the most common response.
You might see ending troubles with original anime (typically from Gainax), but those are typically due to budgetary problems.