A change of key is often shown by a new key signature in the music:
The new key signature is always written after a bar line. Here's an example: Hear it
Notice that any sharps or flats that are no longer applicable are made natural before the new key signature is written. This is not necessary if changing from (for example) two sharps to four sharps, or one flat to three flats.
It is quite common for the key signature change to be preceded by accidentals that move towards the new key; the new key signature is normally written once the new key is established, not before.
If the change is at the end of a line of music, the new key signature is written at the end of the line after a bar line, and then at the start of the next line as normal (the current key signature is always written at the start of every line).
If the change of key is quite short, in other words if the key changes again, or goes back to the same key within a few bars or less, a new key signature is not written, but accidentals are used.
A change of key by using accidentals to move from one key to another is called a modulation, whether or not a new key signature is written.
For sight-singing, both types of key change should be treated in the same way:
If is very useful to establish the new key note, and new scale, and relate them to the previous key.
So in the example above:
The piece starts in E flat major, and the first bar is notes of the triad of E flat major.
The second bar has an F sharp and an A natural and contains notes of the triad of D major (a semitone below E flat), except for the G (which is a passing note).
The key then changes to G major, and the third bar contains notes of the triad of G major.
So at the point of the key change, and during the bar before, a sight-singer should try to establish the new key starting on the note G, which has already occurred twice in the first two bars.