How to pass the throne to my dynasty
Playing as Byzantium, my heir died. The line of succession then fell on the hungarian child of my deceased daughter and her hungarian husband. This takes the line of succession out of my dynasty. How can I maneuver to get a new heir? would the best decision to be to divorce my aged wife (40yrs) (im 53) and marry someone young or do I have other options?
You could try changing succession laws to seniority or elective and vote for a dynasty member.
Unless your wife has reduced fertility because she is chaste or homosexual or something, she should be able to provide you children up to age 45. If all your children are dead, I think she would provide you an heir in a short amount of time since the urge of women (especially those married to current rulers) is to have children until they have at least one girl. Replacing your wife with a lustful 16 year old would give you the greatest chance of having a baby quickly but shouldn't strictly be necessary.
Whether you replace your wife or not you can further increase your chances of having a child by inviting some lustful single women to your castle to serve as lovers. If your wife is too old or is not providing an heir for whatever reason usually you will get an event to hook up with a lover who has the lustful trait and a good opinion of you, which they should have if you are able to invite them to your court. If everyone has a terrible opinion of you so you can't get single women to come by inviting (and bribing if necessary) them then you could marry the lustful women to your other courtiers and you'll still have a chance to hook up with them if your wife isn't giving you the children you need. When the child is born with your lover you will get an event and you choose to legitimize it.