For logistic structures, it pretty much doesn't matter. If you have a starbase, repair platform, or hanger with shield bestowal, put them nearby so they can benefit from the effect. Otherwise, there's not really much you can do with these.
For tactical structures, you want to build in tight clusters, preferably close to the planet. You could also try positioning a starbase near the edge of the gravity well (the AI likes doing this) but this usually leaves your repair platforms and other defensive structures exposed, and a smart enemy will just offset their jump to avoid the death-trap, negating most of the benefit. A starbase closer to the planet allows you to more quickly retreat from any part of the gravity well towards its protection (since it's near the middle) which is useful if you need to make a tactical withdrawel.
Personally, I put my repair platforms and hangers right next to my planet, and my starbase right in front of them. With the planet covering the flank, there is no way to get around the starbase and hit out the other tactical structures it's defending. Placing your frigate factories nearby your starbase is a must.