I'm not sure where you are, but in the states.. (Not a lawyer, seek a lawyer's advice).
If you are not running your own company, chances are you'd file as a independent contractor. Speak to a tax specialist for details about your specific area. Keep in mind that just because you are freelance, doesn't mean you don't pay income tax (again U.S). You are actually liable for the same amount you would get from working for a company (which could mean you end up owing, unless you are making estimated payments).
If you are running your own company, you'd be paid as a employee - but the company would also have to file taxes.
People form companies (such as L.L.C.), in part, to limit while they are liable for. For example, without the protections offered by operating as a company, personal assets could be 'fair game' during lawsuits. Chances are you don't want to lose your say, house, during a lawsuit, so the clear division can be helpful in legal matters. I do think it's worth the investment up front to draw up a contract and have it reviewed by a lawyer who is familiar with IT work.
Contracts clearly need to say up front everything that everything that @FarishKash mentioned, and in addition you need to be very aware of non-compete clauses, or IP clauses. If the company wants to you to sign their contract, instead of the one you had created, I strongly recommend reading every line, and reviewing with a lawyer if necessary.
Payment: It's unlikely you will be paid in cash (because I am assuming you are charging an normal amount which easily takes you into the low hundreds for most simple stuff). You thus need to be able to accept check and credit cards (companies could opt however, to pay you with a credit card if your amount is low enough). You thus need a way to process card payments, which you can discuss with your bank, or use a service like Paypal for business. I do recommend keeping company money separate from your own, as this makes tax season easier.
You should be aware clients may not pay you. You want some up front, for example: half up front, half on delivery, or x amount for every x delivery checkpoint (if using say Agile development, pay per sprint). You should account for this accordingly in the contract you should have. What happens in default, can they keep legally using your code, do they incur daily charges for non-payment, continued use, both, etc.