Background:
Niall was the youngest son of the king. He himself reigned as king, and so did his descendants for 26 generations.
The Story of Niall:
The high king of Ireland, Eochaidh Mugmedon, had four sons by his first wife by Mongfind, and a fifth son by his second wife, Caireann Chasdubh. While Caireann was pregnant Mongfind was jealous and forced her to do heavy work, hoping that she would lose her baby. Caireann gave birth to Niall as she was drawing water from the well. Out of fear of Mongfind she left the baby on the ground. The baby was found by a poet called Torna, who taught him his skill. When Niall grew up he returned to Tara, was accepted as the son of the king, and rescued his mother from her imposed labour.
Niall grew popular among the nobles. Mongfind, afraid that Niall would get more and more popular and would overshadow her sons, demanded that Eochaidh Mugmedon name a successor. The king, unwilling to choose between his sons, gave the job to a druid. The druid trapped all the boys in a burning forge, telling them to save what they could. He then judged them on the objects they chose to save. Brión chose a sledgehammer, Fiachra chose a bellows and a pail of beer, Ailill chose a chest of weapons, Fergus chose a bundle of wood, Niall chose the anvil. Niall was deemed to be greater then the others. Mongfind refused to accept this.
The druid took the brothers to have weapons made for them. He then sent them out hunting. When they had successfully taken down a stag, Fiachra was sent to fetch water. He found a well guarded by a hideous hag. He asked could he draw water. She answered that he could if he slept with her. He have her a kiss, with a look of disgust on his face, but this did not satisfy her. He returned empty handed. The other brothers each went one by one, and each returned empty handed. Finally Niall went in search of water. He lay with her, and afterwards she revealed herself as a beautiful maiden. She granted Niall the right to draw water as well as the right to rule Ireland for many generations. Niall succeeded as king, and Bríon became his second in command.
Conclusion:
Niall proved himself to be the rightful king by his choice of the anvil (stability and creation) over weapons (war), a sledgehammer (destruction), Beer (feasting), and wood (lack of masculinity), and then again by embracing the goddess and enlisting her help.