See our question on hidden city ticketing.
From PriceofTravel, on why it happens:
Airfare pricing is extremely complicated and often an airline has the
choice of running certain segments at a loss by discounting seats, or
a bigger loss by flying mostly empty with higher fares. They need to
get their planes back into the more profitable positions on their
route map, so they discount heavily only when they have to, and
they’ll balance that with profits on routes that other airlines aren’t
bothering with at all.
So perhaps at this time of year, Bangalore to Mumbai can be easily discounted for a small loss by the airline, and then get more bodies onto the pricier flights, making them always have full planes there, and this works out as less of an issue for them than just making the Mumbai->Denver routes cheaper.
Sometimes when the last segment is the pricey one, and you're only going to say, B instead of C, on a A-B-C route, it's sometimes cheaper to buy the longer, cheaper flight and throw away the last ticket. Of course, this doesn't work if you need to get to C. We have several questions on this (search throwing away, or not taking tickets).
As an example, a friend bought a Bolivia->Chile return flight, because it was cheaper than the one-way flight. He just threw away the second ticket :) Airlines do frown on it, however...
I also recommend that PriceofTravel article on Hidden Ticketing for a longish read anyway, it's quite eye-opening.