"Periscopes allow a submarine, when submerged at a shallow depth, to search visually for nearby targets and threats on the surface of the water and in the air. When not in use, a submarine's periscope retracts into the hull. A submarine commander in tactical conditions must exercise discretion when using his periscope, since it creates a visible wake and may also become detectable by radar, giving away the sub's position (Source)."
A periscope from the inside of the submarine. (source).