Especially for something like this http://imgur.com/ROj1kBN (which is originally in D Major), how do I know that it doesn't constitute a key change? A more general question would probably be how do I identify key changes in sheet music in general?
The composer starts in D major, as you say, but temporarily wants to put some D minor flavour in. As it's only on a temporary basis, and he's returning to D major, it's a modulation rather than a key change. So it's easier for everyone if the key signature stays the same, and accidentals are used to signify changed notes.
A proper key change would involve two naturals, at the beginning of the new key, often with a double bar line, and the new key signature put in place. If the new key is C/Am, it looks a little odd, as there would be the naturals, followed by seemingly no key signature.A look at the next few notes should give sufficient clues, though.
There are modulations, and there are key changes. When a piece includes a "development" section, harmonic excursions will generally use accidentals. When it's more of a set of variations, each may get its own key signature. Or a composer may change key signature for purely pragmatic reasons, to make a section easier to read. The ultimate Key Change is the "up a semitone for the last chorus" device, common in popular music. This will definitely get a new key signature!
Is the Ring Cycle a series of modulations - it begins in Eb and also ends there, several evenings later - or are there key changes? Does Bach's 'Minuet in G' modulate to D, or change key? Would we be dissatisfied if the Ring didn't "come home"? What about the Bach? Do you find the unresolved modulation in "Unforgettable" magical, or vaguely unsatisfying?
You wanted an answer and I'm just offering more questions :-) Questions on how to label something often end up like that.
For your particular example, there is no clear way of telling, because it lacks context. In general, the key has changed when music feels more or less "at home" in a key different than the previous one. For this to happen, the new key has to be properly established, and music has to remain in this new key for some time. Therefore it depends on what there is before and after. In any case, the concept of key change (modulation) is kind of a theoretical simplification; in practise, analysis of a musical score is not always white or black.
This is a complex topic, that involves understanding well the concept of Key, function of different chords, etc… If you want to get it right, study a good harmony text. I strongly recommend you Arnold Schönberg's Harmony book. Chapter 9 talks about modulation, but reading previous chapters might also be usefu/needed.