How do I compute the optimal strike / expiry / when to close or roll for a covered call strategy on a highly liquid underlying (e.g. SPY)?
As the comments suggest, there is no "objectively" optimal strategy, and it depends on your goals and risk tolerance.
I personally like to sell covered calls on a weekly schedule, for calls that expire the week after. Of course, the collected credit is lower than with expiration dates further in the future, but it gives me more flexibility. I can let them expire (worthless, hopefully) and then decide from scratch, possibly at a different strike price.
As for the strike price, I set it high enough that I wouldn't mind having to sell, but not higher.
I use it for stocks I bought as an investment (not a short-term trade), but only for stocks I feel I want to keep for a few weeks to months, and not for the ones that I want to keep for decades.