That is called razor burn.
Razor burn is a type of burning sensation you get especially after shaving, and is generally caused by the irritating effects of having all your skins natural moisture harshly removed by a sharp edge, leaving it dry, sensitive and inflamed. The practice of shaving is a very unnatural and high friction process that can produce unfavorable effects in your skin. At times razor burn can be very uncomfortable, and can cause evident bumps and rashes along any place you shave regularly. For centuries people have been using different methods to cure razor burn as it can be both ugly and painful.
Hardly anyone knows how to cure razor burn permanently, but there are a few things you can do to prevent or at least diminish it.
Make sure that you always use a very sharp razor so that you don’t inflame your skin. It helps to take care while you shave as well. One must not use force or apply too much pressure when you make your strokes, a good way is to try and remove the hair as lightly as possible. Don’t pass many times over the same area. Shave in direction of growth, never against.
It’s essential for avoiding razor burn that you soften your skin as much as possible before shaving. Soaking the skin in hot water for 10 minutes, and using skin-softening products will help. You’ll help reduce razor burn if you apply moisturizer to the skin before applying shaving foam.
And do use shaving foam instead of soap. It makes a difference! So does the quality of the razor. Cheap razors that have only one blade always gave me horrible razor burn, whereas nicer ones with double, triple or quad blades tend to cause less razor burn. More blades= less razor burn in my experience.
After you finished shaving, always rinse with cold water.
Some people also find that applying witch hazel or aloe vera gel to the skin after shaving helps.
To avoid razor burn entirely, I simply use an electric razor instead of a blade, or I wax rather than shave. And some women just choose not to remove leg hair, which is also ok if their hair is very fine, or if they wear long skirts/pants and the legs don't show.
Hope this helps!