Anne Frank's father Otto owned several buildings in Amsterdam as part of his business, and though he had to put them in a non-Jew's name in order to keep them from being confiscated, he was able to secure a secret place for his family and the Van Daans to hide in in 1942. Basically, it was a secret annex above a warehouse, with the entrance hidden and windows blacked out so that nobody could tell from the street that anyone was inside. As Frank herself said, "No one would ever suspect there were so many rooms behind that plain gray door."
They had to be so secretive because the Nazi occupiers not only punished Dutch people who would not turn over Jews, but gave financial rewards to those who would do so. Despite this, they were basically able to hide as long as they did because of the help of other people. Miep Gies, the person who actually safeguarded Anne's diary after the family was discovered and sent away, was one of the people who smuggled them food and other necessities.