It depends which airfields you operate into or out of really. I would say most times you tend to fly at least the first part of a SID and when handed over to the Approach/Radar controller that is when he/ she may put you onto a heading or clear you more directly. As already pointed out by lizbet you control the Flight Director through the MCP (Mode Control Panel) thus enabling correct indications to be given at all times.
On approach again you may well fly the first part of a STAR and then be given radar vectors to the final approach path. If you have no Radar controller then you will fly the full arrival and the procedure, conversely you will quite often fly non of the programmed STAR at certain airfields, The MIRSI arrival from Monty into Manchester springs to mind (having just flown it a couple of hours ago!), we were given a heading by London control somewhere near Brecon and never got onto the STAR, even when subsequently cleared to MIRSI and then handed over to the next frequency who immediately put is on another heading to save a few more track miles. When this happens you can either update your routeing in the FMC to reflect what you are actually doing (to give you a realistic track miles to run), airmanship dictating if there is time to do this (one guy heads in for a while when getting low down in a TMA) or just 'guesstimate' your track miles using a suitable DME on the field (or fix on the airfield in the FMC) etc etc.
So the trick really is experience (route and airfield knowledge) to know what you are likely to get from ATC so when it happens it doesn't take you by surprise!
PP