great question

i'd say it's just a particle of a more expressive general question, which usually expresses doubt and surprise (both positive and negative) or anger
Normally it's appended at the end of fairly short phrases and supposed to mean seeking confirmation rhetorically.


Are you idiot? - Ты (что,) идиот что ли?

Did she leave (already)? - Она (уже) ушла что ли? (meaning the inquirer didn't expect her to leave or to leave that soon)

What, should I sit here til tomorrow morning? - Мне (что,) сидеть тут до утра что ли?

Don't they know it's forbidden? - Они (что,) не знают, что это запрещено, что ли?


in expressions of anger and agitation it can be translated as "or what?" (what - что, or - ли, short for или)


Don't you see what's written here or what? - Ты (что,) не видишь, что тут написано что ли?