Want to game the marriage system without cheating? You need high state intrigue for this or willingness to deal with kinslayer penalties to opinion.
Marry someone with a claim on a county/duchy/kingdom/empire (something you can beat with military). Have a son. Kill wife's father. Kill wife. Son gets "weak" claim. Assassinate ruler of county/duchy/etc, till its in regency. Then, declare war for the county/duchy/etc and conquer it whole. Your son now is rule of said county/duchy/kingdom/empire. Kill your son. You now inherit it.
Rinse and repeat. When in your 30s, marry a genius wife, get a genius son and make him your new ruler. Kill non genius sons who take priority for inheritance. Rinse and repeat.
Less gamey mechanic?
Marry your ruler (count/duke/king/emperor) to a female ruler of the same level. Your children will inherit both your lands. Or marry your heir to a young female ruler in regency, and the game lets you marry non-matrilineally usually. Adults with holdings generally won't marry your heir unless he has a similar level holding.
Somthing in between?
Marry someone with a claim to the territory you want. Have a son. Assassinate all other heirs, till wife is heir, then kill wife's father (or whoever controls holding). Don't rinse and repeat and don't conquer, just use assassinations till your wife gets the land and your heir will eventually get it as long as both your heirs are the same (similar succession laws and same first son/possibly daughter if absolute cognatic). This won't work if agnatic succession, but will work with the more common agnatic-cognatic succession. The first option is the only one of these three that works with pure agnatic succession laws.
Note: Generally best to just avoid this and just marry someone with high stewardship and the genius trait. I only did the first option in my game where I rushed to conquer the whole map as fast as possible. Its gamey and should not be done your first few games.