re: layer content via -drawRect: or -drawLayer:inContext:
Normallly or always? and this is valid only for view's hosted backing layer or every layer
I add as a sublayer to the backing layer?
Always. When these methods are called, the current context will already have the scaling factor applied. For instance, if your layer is 10pt x 10pt, it has a bounds of {0,0,10,10}, regardless of contentsScale. If the contentsScale = 2 (e.g. you are on retina), this is actually 20x20 pixels. CALayer will have already setup a 20x20px backing store and applied a scale factor CGContextScaleCTM(context, 2, 2).
This is so that you can do your drawing in your 10x10 conceptual space either way, but the backing store is doubled if the pixels are doubled.
I'm having difficulties imagining a layer without a view, I can imagine a hierarchy of
layers but as soon as I want to display them I should add it as a subhierachy of the
view's backing layer, or do exist some other means to use them (like creating and just
renderring in a context)?
You can create them, add them as sublayers, and either set their delegate to an object where you implement -drawLayer:inContext:, or you can directly set the layer's contents. On iOS, UIView is a fairly shallow wrapper around a CALayer so it generally makes sense to create subviews instead of directly making sublayers, which is why you aren't so familiar with this usage. On OS X, a layer-backed NSView is a big and complicated wrapper around a CALayer, so it makes a lot more sense to make whole hierarchies of layers within a single view.
What does that actually mean? When I do something like that layer.contents =
(id)image.CGImage I need to set the contentsScale.
Yes. But what this passage in the documentation is telling you is that if you want to not look ugly, a 10pt x 10pt layer with contentsScale of 2, needs contents that are a 20px x 20px image. I.e. You need to pay attention to the contentsScale of the layer when you are directly setting the layer contents if you want to avoid scaling artifacts.
Do I also need to set it when my layer draws it's contents calling the delegate method
drawLayer:inContext: and the layer isn't the backing layer of a view?
Yes. If you are creating layers yourself (not created via a UIView), you need to set their scale manually. Usually this is just layer.contentsScale = [[UIScreen mainScreen] scale]. (Again, on OS X this is a little more complicated since screens can come and go while running.)