Raphael skeletal anatomy! Click for better quality
Turtle shells are really funky, and in real life turtles, their shoulders and hips are actually fused to the shell and form immobile shoulder and pelvic girdles. Their scapula (shoulder blades) therefore are pushed almost fully downwards to give turtle arms that elbow up look. Most of their muscles are attached via ligaments to their plastron and limbs, with their large neck muscles reaching back along their spine with very minimal muscles on their sides or back.
Because of how funky their bones are, I tried to find a good middle ground between the brothers’ humanoid shape and mobility vs. their original species limitations. Their shoulders are very human, with their collarbone instead connecting to the top of their plastron rather than a sternum (flat bone in the middle of the ribs) with the addition of their shoulder blades resting much lower than a humans and protecting the open space in the armpit of their shell (rather than being set on their back under their carapace). Their necks can stretch slightly longer than a humans and have some extra mobility, on account of how they usually sit curved and tucked into their shoulders. Their pelvises and lumbar vertebrae (hips and lower back) are not fused to their shell to enable them to twist their torsos some.
As for how flexible the show depicts their shells to be… suspension of disbelief! I like to keep the idea of their shells being turtle like, so even though they’re all bone, I’ll allow cartoon physics to bend them some.
Additional info on Raph: The spikes on his shell are mostly bone. Also (something I didn’t draw because it was only after I finished this that I was able to find a picture of an alligator snapper shell bone without its scutes) there are small gaps between his pleural bone plates (middle of shell) and his peripheral bone plates (edges of shell). The scar on his shell is probably from a bone deep injury, as broken scutes shed away, but because scars don’t grow with a person, the injury is small enough that it probably happened so long ago that Raph can’t even remember it.
This is all just my speculation, so feel free to disagree or expand upon these ideas!