First thing is to open 'System Preferences' from under the Apple menu at the top left of the screen and click on 'Sound' in the row of Hardware icons. Click on the 'Output' button, the middle of three buttons at the top of the window. If you have a USB output device plugged into a USB port it should show up there and you'd click on it to select it for output.
Similarly, if you have a device with optical input plugged into the headphone jack it should also be in the list.
Similarly, if you have a device with optical input plugged into the headphone jack it should also be in the list.