Camera shifting occurs for many reasons, it can be for the ease of conceiving a gameplay mechanic / part, or to make the task easier for the player, and such things, camera shift can occur for a pinpoint move/action up to an entire gameplay section. Camera shift isn't a volunteer action it's linked with a particular action or location.
A game can use a third person view as a main view for most of the actions and when it comes to a shooting sequence the view swaps to a first person view, until you complete the section.
The other example is the use of a cover system in a first person shooter, most FPS uses a cover system that swaps the view in third person and the first person view is regained when we stop to press the cover button
The use of a ladder in certain games can swap the view when we climb a ladder, Turok (the last) uses camera shift during this action
Quick Time Events can do this as well and even some melee kills, stealth kills and combat actions (like when we use the Fallout 3's V.A.T.S.).
The use of a vehicle, certain first person games swaps the view in third person when using a vehicle, often because that's easier to control since we know more easily how to not hit a wall rather than in first person.
In third person games, it happens when we enter in a vent since having the camera behind the player's character because doesn't allow to see what's in front of us.
Aiming with a weapon in certain games, such as Metal Gear Solid 2, for example, switches the camera to first-person view. Some games, such as the early Metal Gear Solid games and Rainbow Six: Vegas, switch the camera to a third-person, over-the-shoulder view, when taking cover.