It was narrated from Imran bin Husain that: The Prophet ﷺ led them in prayer and forgot (how many rak'ahs he had prayed), then he prostrated twice, then he said the salam.
The Prophet's example also shows us that no matter who we are or what position we hold in society, everyone makes mistakes and forgets things sometimes. It is important to remember this when making judgments about others or ourselves; no one should be judged harshly for making a mistake or forgetting something because everyone has done so at some point in their lives.