Thank you for the information,
From your symptoms it appears to be epidermoid/sebaceous cyst.
The cause is due to swollen hair follicle.
Trauma to skin can initiate it.
Discharging blood & pus can be due to an infection.
You need to get it examined by doctor.
Warm moist compress can be applied.
Antibiotics may be needed.
Other treatments include surgical excision, corticosteroid injection, laser etc
I hope this information will be helpful.
Please ask if you need any clarification.