How can I detect unavailable segments?

You can detect them through monitoring, specifically the segment/unavailable/count metric. You can also look at the is_available column in sys.segments. Read more about metrics here, the segments table here, and some great context here.