Why do many anime not follow the manga? Why are they usually made shorter? Many anime do not follow the manga history and are made shorter. However there are a few that do follow it or try to finish the history with the manga like the big three (Naruto, Bleach, One Piece), Death Note, and FMA Brotherhood. But others finish the anime without the real ending like FMA, Ouran High School, Pandora Hearts, Tsubasa Reservoir Chronicle. Why is this so? Is it because of the high cost? Or the lack of popularity?
The television broadcaster allots a specific number of seasons for the anime, depending on commercial considerations, such as popularity of the source material (manga), target audience, timeslots available, etc. If the manga would not conclude by the time their allotted season ends, they usually create an alternate ending, so that the audience does not feel like they abandoned the series.

The more popular series such as Naruto or One Piece can reasonably expect that they would get several seasons, till the manga ends and hence can follow the manga closely. However, such anime could also end somewhat abruptly, if the broadcaster decides to not allot them any more seasons at some point, as it happened with Bleach after the Fullbring arc, for example. 

In some cases, when the anime production company works closely with the mangaka, they can keep their ending consistent with the manga, even though the manga has not been published, but this is rare.