TL;DR - Winning material is usually good but it's checkmate that wins a game of chess.
In chess there is only 1 primary aim, to checkmate your opponent before she checkmates you. ALL other aims are secondary. Thus a good move is one that makes you more likely to checkmate your opponent before she can checkmate you. End of story.
However great though that be it doesn't always provide a whole load of practical guidance when sat at the board with the clock ticking louder and louder. Thus as players of the game we employ a number of secondary objectives that experience has taught us will, with a good degree of probability, lead to the primary objective above, e.g. control the centre, develop your pieces, force your opponent to make weaknesses, win material, with your extra forces checkmate your opponent - it's only the last that counts, the others are just useful, but often very useful, stepping stones to that end.
To get to some of the more specific parts of your post, yes, the vast majority of times winning material is a good thing. To use the military analogy you now have more soldiers than your opponent, and more soldiers in a war is generally a good thing. Here's an example from a game I played at the club earlier this week:
[White "Me"]
[Black "My Victim"]
[Result "1-0"]
[FEN "r3q1rk/pp2p1bp/3p1p2/3P1PnQ/2P1B2R/1P2B3/P6P/2R4K w - - 0 1"]
1.Bxg5 Qxh5 2.Rxh5 fxg5 3.f6 h6
( 3...Bxf6 4.Rxh7# )
4.fxg7+ Kxg7 5.h4 1-0
Why has my opponent resigned? Well ultimately it is because he believes I am a good enough player that one extra piece is enough for me, in the long run, to force checkmate against him. At the board he'll say "Oh, I dropped a piece to Ian so resigned", but this is really a short hand for the above - Checkmate is the ultimate aim in chess, all others are secondary.
However you are also right in saying that it does depend on the particular situation, and this is because while a great aim winning material doesn't win the game of chess, checkmate does. And thus occasionally a player will give up material because he or she thinks or has calculated that doing so will make it more likely that they will checkmate their opponent before their opponent checkmates them. Be very clear that this is the exception rather than the norm, but it's having to evaluate such possibilities that makes chess such a great game! As an example here's one of my favourite games of all time. Black gives up loads of material but it's all toward the end of queening one of his pawns, and with his new queen he will checkmate his opponent - and checkmate is how you win a game of chess!
[Event "Student Olympiad, Marianske Lazne"]
[Site "Marianske Lazne CSR"]
[Date "1962.07.??"]
[Result "0-1"]
[White "Eduard Gufeld"]
[Black "Lubomir Kavalek"]
[ECO "C64"]
[PlyCount "64"]
[FEN ""]
1. e4 e5 2. Nf3 Nc6 3. Bb5 Bc5 4. c3 f5 5. d4 fxe4 6. Ng5 Bb6
7. d5 e3 8. Ne4 Qh4 9. Qf3 Nf6 10. Nxf6+ gxf6 11. dxc6 exf2+
12. Kd1 dxc6 13. Be2 Be6 14. Qh5+ Qxh5 15. Bxh5+ Ke7 16. b3
Bd5 17. Ba3+ Ke6 18. Bg4+ f5 19. Bh3 Rhg8 20. Nd2 Bxg2
21. Bxg2 Rxg2 22. Rf1 Rd8 23. Ke2 Rxd2+ 24. Kxd2 e4 25. Bf8 f4
26. b4 Rg5 27. Bc5 Rxc5 28. bxc5 Bxc5 29. Rab1 f3 30. Rb4 Kf5
31. Rd4 Bxd4 32. cxd4 Kf4 0-1