(Assume you haven't done the Rillifane ritual yet)
1. Collect first to ritual items (talisman and moonsword).
2. Open both sets of gates to palace (convince guard to open first set, then open second set and kill Balor).
3. Go kill dragon and retrieve final ritual item (cup).
4. Go back to Rillifane temple and place the three items in the water, talk to Rillifane.
6. Leave temple, talk to merchant, do a bit of shopping.
7. Go to castle. Final gate appears closed now, but you can walk right through it.