How to select certain Shift Register outputs?

I have used 74HC595 shift registers in the past, and I know how the serial data is shifted in and out of them, but every piece of example code is always shifting in a sequence. Is there any way I can select specific shift register pins and set them high/low?

Yes - shift in new data for all pins that has only the required pin changing state.

So if I wanted to turn on the first and last led the serial input would look like this: 10000001

Maybe ... the middle bits need to be the same as previous data, or they'll get cleared (unless that's what you want).

No, you cannot address specific pins in an HC595. You must always shift out all 8 bits. You must remember the old state, change only the selected bits and than shift out the complete byte.

Can I just clear the previous data and shift in new data?

You can do whatever you want with the data, manipulate it in any way then shift it into the shift registers. The outputs won't update until you apply a pulse to the output storage register clock (check the datasheet).

You don't have to clear anything. The new data simply overwrites the old one.