The Royal succession prioritises male heirs but does not prevent a female inheriting nor does it preclude inheritance through the female line though inheritance through the male line comes first.
So the present Queen has her eldest son has her heir and Princess Ann comes way after all their descendants whether female or male. That's why Prince Andrew's daughters are nearer the throne than Princess Ann.
However in the world of landed titled folk it is relatively rare for this to apply and titles (and estates attached to them) follow the male line ONLY. This means that Mary et al could have 15 sons apiece and none would ever inherit because their connection to the title is through the female line.
To go back to the family tree - picture this (made up example):
Robert 1st Earl of Grantham has three sons and two daughters.
His oldest son Robert has a son, Robert who becomes the 2nd Earl and he has a son who becomes the third Earl and he has a son who becomes the 4th Earl. The third Earl we presume had at least one other son who also had male descendants. They were the back up heirs till the Titanic came along and were Lord 's first cousin/second cousin descended through the 'senior' line. The 4th Earl marries Dame Maggie and has at least two children - Lord G and Lady Grumpy.
To go back to the 1st Earl - his younger son - lets call him Matthew would be Lord Matthew Crawley (I think) and he has a son who has a son who has a son (Matthew's father - by which time any title is totally wiped out and he's just plain Mr) and he has a son - Matthew. This would be a 'cadet' branch of the family and in the event of the senior line failing - no males - it comes in to it's own.
The 1st Earls other son also either has descendants who are:
a) all female - and thus the title cannot pass down through and to them
b) dead
c) non existant
or d) male and descended through the male line but Matthew comes first because Lord Matthew is the older brother.
The 1st Earls daughters - just for fun (or confusion) called Mary, Edith and Sybil also have descendants but none will ever be heir because their 'claim' is through the female line.
An exception to this rule is the Dukedom of Marlborough which has descended through the female line.
If you want to see a modern day Downton like example look at the Dukes of Atholl. the 11th duke is the second cousin once removed of his predecessor - who never married or had children.
Hopefully that's clearer?