If someone prays, and finds, after completion of the prayer, that something has exited from his private part, then his prayer is valid. He does not have to repeat the prayer.
This is because doubt after the completion of [an act of] worship is not to be taken into account. Ibn Qudaamah says:
If one doubts after having completed it, he is not obliged to do anything. This is because doubt regarding a condition related to a [form] of worship which results after completion does not have any affect on it [i.e. the worship].
However, if a person is sure that something exited while praying, prior to completion of the prayer, then the prayer is invalid and one must repeat it.