When working with electricity, rubber shoes are recommended because they prevent current from running through your body. But I've read that usually the earth is more negative charged than positive. So how is it possible that contacting the earth is dangerous in some situations as it is also negative charged, and when you touch an electrical wire you also get a lot of negative charges (electrons). So in theory, they should repel each other, but apparently, they attract each other to cause a current in a body. How is this possible? Isn't the earth negative charged (most of the times)?
The electricity you're talking about is the man-made kind, which is completely independent of any charge the Earth has relative to its atmosphere. Man-made power sources are almost all referenced to the Earth as zero volts, as established by connecting the "ground" to a conductive rod driven into the ground. Each house's electrical system is also grounded in this way. Since earth (lower-case "e") is at least somewhat conductive (except for perhaps dry sand), if you grab a conductor while standing barefoot on the ground then current will flow through you, through the ground, and then back to the source of electricity and/or your house's local grounding rod. Enough volts, and good enough conduction, and you get hurt or killed. Rubber shoes, rubber gloves, and just plain common sense can prevent this.
Again, this has nothing to do with the charge the Earth has relative to its atmosphere, as man-made power is generated referenced to Earth ground; plus, since it's almost always alternating current, the polarity changes 50 to 60 times a second, so any purported existing voltage wouldn't protect you.
You are at the same voltage potential as the earth most of the time, so you don't get zapped. Electrical current only exists where there are voltage differences, and a path for the electricity to flow through.
Imagine a big pond full of water. The water just sits there, right? Now imagine you dig a ditch to an adjacent dry pond. Now there is a difference in potential energy (thanks, gravity), and there is a path through which the energy can travel to seek a steady state again. Once enough water flows from the full pond to the dry pond, the energy potential (now think of this as voltage) will be equal and water will stop flowing.
Electricity is not so different in this sense. Electromagnetism is what holds the very atoms of your body together. It's pervasive and there are voltages on everything all the time. What you think of as electricity is electrical current, which is the phenomenon of electrical charge moving from one place to another.
If two items both had a 1,000,000 Volt electrical charge on them and they touched... nothing would happen. There's no voltage potential between them. Bit if one had a 1,000,000 Volt charge and one had a 1,000,120 Volt charge, and you ran a wire between them, you would read 120 Volts on that wire at least momentarily, and that reading would decrease until it reached 0, when the two objects reached the same charge.