There're two components involved in getting a spent case out of an AR15: the extractor and ejector. After firing, when the bolt moves back and rotates, the cartridge case rim pivots on the extractor hook (the part pulling the case out of the chamber) to send the case out through the ejection port. The ejector functions to "present" the case at the right angle--at the right time--to clear the port. So the extractor serves as a fulcrum for the case to pivot from, while the ejector gives it a kick in the right direction. Gods willing.
The part itself is a small spring-loaded plunger housed in the left side of the bolt face. When a round is chambered, the ejector compresses flush with the bolt face. It applies pressure against the case head so the case will then point off to the right as the bolt retracts and the case is pulled clear of the chamber.
Unless its spring breaks, there's really nothing preventing an ejector from doing its job. Ejection maladies are related to how well it's doing the job. It's all about spring tension--not enough and the case doesn't tilt far enough, fast enough. Too much pressure and it tilts too far, too soon.
A QUESTION QF PRESSURE
One symptom of not enough pressure is the case staying inside the upper, maybe getting partially out through the port. But either way getting trapped as the returning bolt carrier group brings in the next round. The case bounces up rather than out. That there's what most of us call a "jam."
Too much pressure? The case can bang off the rear of the ejection port instead of just hopping out like it's supposed to. You'll get wildly spinning cases going off in all directions and flying too far. It's the cause of the creases, dings and dents on spent cases. Excessive rearward bolt carrier velocity (common with carbine-length gas systems) can create/worsen this condition. I've seen this after trying a different load in a rifle that had been ejecting perfectly. The cure for this is slowing carrier velocity.
When the ejector's functioning just right, there ought to be a neat pile of unscathed empties deposited at about 3-o'clock and no more than three feet away. It's all about "timing."
A new spring is the cure for an under-functioning ejector. If you need one, I strongly recommend upgrading, and I recommend it anyhow. I do it on all my guns since this spring will weaken. They're also prone to breakage due to heat. I like chrome-silicon springs...