Wow... that's an open question because the possibilities are so varied. But we had our daughter on the water since she was 3 months and now she's 18 yrs. So we've seen all the stages. Just go sailing, maybe overnight once they've been on the boat a few times starting with the eldest first and take it from there. Like any kid, you have to keep them occupied. Don't expect them to love it on day one or in the same way for each kid, they'll like some things and hate others.
2 yr: stay close to mom/dad. Toys in the cabin or cockpit. Not much different than on land at that age. They scare easily so keep it calm and not loud (sail changes, tacking, no shouting), easy days. If you see weather coming, get in. Naps in the V berth surrounded by pillows. They roll around easily and don't get banged up. Our daughter would fall asleep within 30 minutes leaving the dock and sometimes slept for hours. Changing a diaper at 20 degrees heel is a thrill.
5 yr: - more possibilities depending on whether they can swim. Swimming from the boat, fishing, small boat jobs, learning a little about water creatures. But they still like their toys, so keep them around. NO electronic toys or videos. Play on a sand beach digging holes..... Keep it calm because 5 yrs is still tender. If weather comes up, explain what a big wave is and isn't. Our daughter asked this all the time.
9 yrs: - you have a mini mariner. They can definitely tend jibs, tack the main, learn to steer, learn basic weather, plot a simple course (it's not PC, but consider doing this electronically because electronics are like catnip to kids, especially boys). Definitely kayak solo, row a dinghy.... all stuff our daughter did. Can handle bigger weather, maybe up to 20 kts. depends on the kid, but introduce more aggressive conditions incrementally.... don't go from a series of 10-15 kt days to 30.
Some other considerations that I posted recently:
Life Lines and a 3 year old...