Removing a broken light bulb from a screw-shell lamp holder can be dangerous if you don't solve two problems: First, how do you know the electricity is really off if the fixture or lamp holder is controlled by a simple on-off switch (or a pull chain)? Second, how do you get the broken light bulb base out of the lamp holder without cutting your hand or damaging the inside of the lamp holder?
When a light bulb is stuck in its socket, the culprit is usually corrosion between the socket and the bulb's metal base. This is most common outdoors and in damp places like basements and bathrooms.
If you have a bulb that won't budge, put on heavy gloves and eye protection. Make sure the light switch is off, then check the base with a non-contact voltage detector just to be sure, especially if you live in an old house. Then go ahead and twist as hard as you like. Don't worry about breaking the bulb. In fact, if the bulb just won't turn, your next step is to break it intentionally. Hold a screwdriver tip against the bulb and give the handle a firm whack with a hammer. This leaves the bulb's metal base in the socket.
Often, you can unscrew the base by inserting a pliers and holding the jaws open as you turn. A potato might work too: Round the end of the potato with a knife, jam it into the socket and turn. If neither of those methods work, use a needle-nose pliers to remove the bulb. Firmly grab the bulb's metal base and turn, but avoid damaging the light fixture's metal screw-shell lamp holder.
For badly corroded bulbs
If your bulb base is really stubborn, use hot glue and a 1/2 x 1/2-in. stick of wood. Apply a heavy blob of hot glue to a stick and press it into the broken bulb's base. If the glue doesn't fill the base, inject glue into any voids. Let the glue cool for five minutes and turn the stick to screw out the base.
Save yourself all this hassle in the future by applying a special lubricant such as Bulb EZ to the new bulb. Find it online. (Ordinary lubricants like WD-40 or petroleum jelly are not recommended.)