On the Limitations and Capabilities of Position Embeddings for Length Generalization