Understand ejection path and why,
The reason for an initial ejection path out the ejection port is the dead blow weights in the buffer.
At the back of carrier stroke on cycle, the B/C stalls out for a second at the back of the stroke via the buffer doing a dead blow effect, and this is when the spent case should finally pivot off the bolt face.
If the above is working correctly, hence the carrier is coming back fast enough to cause the buffer to dead blow stall, then what can change this path is the bolt retracting too far back past the back edge of the ejection port, the case hitting the upper receiver defector, the extractor hanging on to the spent case rim too much, or just a weak ejector spring or the ejector binding up in the bolt face channel.
As for what can cause the B/C not to cycle correctly, it can be that the bolt is unlock too slow and causing a semi short stroke, or the bolt unlocking too fast with the spent case still too pressure welded to the chamber walls via the residual bore pressure still to high hit still, and it too causes a semi short stroke as well. Hence semi short stroke, since although the buffer may have made it all the way back, it was not enough speed at the bumper tagged the back of the tube to cause the dead blow effect of the buffer.
As for telling of the bolt is unlocking too fast since it and under gassed will act the same with the semi short stroke, just look at the spent case rim. The tell tale sigh will be the spent case rim bend to hell from the over the top pull on the rim via the extractor when the bolt unlocked too soon.
Note dirty or rough reamed chamber will also cause the same problem, with a hard pull and the spent case rim bent to hell as well.
And if you were wondering, the First full auto ar-15's, did not have dead blow buffers. Instead they just had a piece of plastic the size of a buffer that was used as the carrier limiter, and since it did not have any kind of dead blow effect, the ejection path of the spent rounds on it where at the 2:00 out the port.
So dead blow buffers where part of the first M-16 rifle to slow the cycle rate down, and when it changed the ejection path from forward to the rear, the first upgrade on the M16 a1 was to install a upper receiver deflector for left hand shooters so they would not catch the spent brass in the face.