An excellent question.
The Bible is a collection of books written by different people at different times in the history of Judaism (the Tenakh) and Christianity (the New Testament). The question ought, perhaps, to be more specific in asking about the authorship of a particular book, rather than the whole library.
Biblical authorship is a large area of debate among scholars, and there are often disputes among them about who is correct. Of course there is a small number of Christian groups who might say that God wrote the Bible, but scholars have problems with this view.
In response to the second part of your question, it may depend on what you mean by 'know'. You could start by asking yourself how you 'know' anything at all. Most of us would feel confident in saying that we know about events we have witnessed personally, but what about those we have not?
When your parents tell you about what you were like as a baby or a toddler, how do you know that what they are telling you actually happened, if you cannot remember the events yourself?
We tend to believe what people tell us because we have learnt to trust them. It is the same with Holy Books. Because the books have been handed down from generation to generation of believers, they have acquired an authority for believers today.
However, we also need to analyse the biblical stories in the context of when and why they were written down, because they are ancient texts produced by people who had no idea about who might be reading them thousands of years later.
In analysing the texts, scholars look at factors which may have influenced the writers and 'coloured' what they wrote. You need a very critical eye, like a forensic detective, in order to spot things which the ordinary reader might miss.
Scholars publish books and debate the validity of their ideas at conferences. There are many disputes as they, like the biblical writers they study, also have their axes to grind.
Whether any of this gets us anywhere is also a matter of debate! Sometimes the scholars have to say that they just don't know certain things about the texts. In the end we may have to accept the texts as they are, and take from them what we need. The stories they contain are well known and have influenced western culture ever since they were written down.
It seems to me that it is not possible to take the stories literally, word for word, as if they were science or history textbooks. If we can look beyond the literal, we may find that there are truths which still have meaning for us today. We do this quite happily with other stories such as 'The Tortoise and the Hare' - we know that hares and tortoises do not have conversations nor do they hold races, yet we continue to re-tell the story because it contains truth.