All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
First of all, you should know that scholars held different opinions regarding the impurity of puss; some held that it is not impure, and this was the opinion chosen by Shaykh Al-Islam Ibn Taymiyyah .
In any case, if you doubt that pus or blood came out of your scalp, then you should act upon the original state, which is that nothing came out (i.e. ignore the doubt). If something came out and you became certain that it is blood, then you should know that the insignificant amount of blood or pus is excused by the majority of the scholars, even according to the view that puss is impure.
If you doubt whether the amount is insignificant or not, then you should act upon the original state, which is that it is insignificant and, accordingly, pardoned. In fact, some scholars held that what comes out of an abscess is pardoned even if it is a significant amount as long as the person does not deliberately burst it open. Accordingly, your prayer is valid – Allah willing – in light of what you mentioned. So you should ignore such doubts and give them no attention at all.
If you have become certain that a significant amount of blood or the like came out of your head that must be purified, then it is sufficient to pour water over that spot until it overwhelms the impurity and removes its bulk. Any remaining, insignificant trace is pardoned, as we mentioned above.
Allah knows best.