Is it important to purchase tickets in advance for Castel Sant’Angelo, or is it okay to wait to buy them on-site?
I don't think you need to purchase tickets in advance, (as of Dec 2023) but if you get there first thing when it opens, there will be fewer people. We saw a longe line later in the day.
As above, get there early, buy your tickets at the gate, and enjoy the Castel. We got there just after they opened at 9 am and there were maybe 6 people in line ahead of us. There are some spectacular views of St. Peter's from the roof. I feel it's one of the most underappreciated sites of Rome.