How does Nincada evolve into Shedinja? Nincada can evolve into both Ninjask as well as Shedinja.
But under what conditions it evolves to either one of these?
So far I believe we have only seen a sort of evolution happen once and this was in the Pokemon Adventures manga.


  Shedinja first appeared when Aqua Admin Amber, having been deprived of his Pokémon after being abandoned by Archie, borrows a Nincada from his comrade Shelly, which then immediately evolves into a Ninjask, putting Wattson in quite a pinch with the incredible speed it gained by the minute. Although the old Gym Leader eventually managed to defeat it, a Shedinja formed from the shell Ninjask shed and attacked him from behind, sending him sinking into the ocean. 


In the highlighted part, it states that the Shedinja formed from the shell of the defeated Ninjask shed. This also does explain why Shedinja is a Ghost Pokemon instead of a Flying Pokemon like Ninjask.

So my final conclusion is that in the story for a Shedinja to be created, a Ninjask has to be defeated/die.

Source: Bulbapedia