The only way to tell the difference between literal and figurative is context. For example, when we find something in a historical book, like the book of Kings, then it is likely to be literal. When we find something in a poetic book, like Psalms, then it is likely to be figurative. However, even then we need to be cautious. Sometimes in the book of Kings we find prophets using figurative language, sometimes in the Psalms we find the psalmist writing about a real event. Therefore we have to look carefully at the context and ask ourselves if the author is writing literally (e.g. history) or figuratively (e.g. parables, visions, etc.).
If you are thinking about a particular number in the Bible then it might be useful to ask yourself, “what would this mean if it was literal?” and “what would this mean if it was figurative?”.