What's the specific cause of the headphone/built-in speaker switch? So for a very long time this question has been asked and asked again: How can you play audio from the built-in speakers with the headphones plugged in?

When other people's Macs are dual booted (including mine), into Linux, or Windows, it is very much possible to switch between the built in speakers and headphones. The same with the startup chime, which sounds through the speakers with the headphones plugged in. 

It's not hardware [or at least, not always], so where is the cause found in software? Is it at the kernel level? Is there a private API for sound management?
option click on the speaker icon in the menu bar. There you can select the output:



The screenshot doesn't list a headphone, because I don't have a pair on me at the moment..

Alternatively go to System Preferences --> Sound --> Output and select you prefered output: