It grew in popularity after Rani Karnavati, the widowed queen of Chittor during 16th century sent a rakhi to the Mughal emperor Humayun when she required his help in saving her kingdom from the Sultan of Gujarat who attacked the Kingdom of Chittor. Humayun is said to been touched by the bond and marched to protect the kingdom of Chittor to help the distressed Rani but he could not reach at the right time and the Rani, along with other Rajput ladies committed Jauhar to save their honor.
The brother in return offers a gift(usually with an envelope filled with money) to his sister and vows to look after her. North Indian families promote a culture of giving cousins a status similar to siblings hence girls and women often tie the rakhi to their male cousins some other communities also follow this practice. It is not necessary that a girl can tie rakhi only to somebody from the same family hierarchy, it can also be tied to men with whom they share a brother-sister like affection.