If you buy the house they usually give you back the earnest money check uncashed. I always paid either $50 or $100. You can still back out after the option period but it will cost you. 7 to 10 days is typical. If you have never done this try to get 10 days because it might take several days or more to get your inspector out there. You could always call a different inspector if yours is booked up but it is a lot cheaper to find one you like and use them all the time. The guy I use only charges me $250 per inspection (sometimes less) but I have hired him to inspect at least a hundred houses.
The reason I say go for as long an option as possible is that several times there were things I didn't realize until after 7,8,9 or 10 days even after the inspection. Sometimes you talk to different people and find out things you didn't know before and it changes your mind. One time I was going to buy a house really cheap that had foundation problems. I have a great foundation guy. After about 7 days I found out that the entire neighborhood was built on top of a landfill so it is likely that the foundation would have to be repaired over and over and over. I passed on that one. I have only actually bought 7 houses but had over 100 under contract. Many realtors will try to pressure you into a short option period. Some will say 2 or 3 days. I wouldn't do that unless you have a lot of experience.
A good realtor is great but a bad realtor is really bad. One way to try to get an idea if they are good or bad is mention bidding on a house without looking at it first. A really good buyers agent will advise against doing that and a bad one will be all for it or maybe even suggest doing it. There are some buyers agents who actually look out for the best interest of the seller rather than the buyer. Stay away from them.
It might be different if you are getting a mortgage. I have always paid cash until now. Now I have a home equity line of credit with Spirit of Texas Bank but I haven't found the right house yet. So I am still actually paying cash for the house I am just borrowing the money. There are not nearly as many houses for sale now as there were last summer. At least in Tarrant County anyway.