I would go see your primary care doctor
about this. They will be able to examine the lump and help you figure out what it might be and if it requires any particular treatment.
One of the possible causes of this lump is that you may have developed a cyst under the skin of your scalp. Cysts are benign tumors which can occur almost anywhere on the body, even on the head. They are common and usually not a big problem, but they can be painful if they grow rapidly and, sometimes, may need to be removed surgically.
It is also important to rule out an infection of the skin at the base of the hair shafts, known as folliculitis. This is, again, quite common, and it can sometimes be cleared up with good hygiene and topical anti bacterial ointment, although sometimes it may require prescription oral antibiotics.
Finally, occasionally inflammatory conditions of the scalp such as psoriasis
or seborrheic dermatitis may cause painful or itching nodules to form on the scalp. Typically, these would be treated with topical shampoos or creams to reduce the inflammation and allow healing to occur.
Start by making an appointment at your convenience!