To answer you first question about whether or not you need clearance before getting hired, the job requirements should have specified whether or not you needed to have an active security clearance beforehand or not. If it did not, then it will be discussed in a phone interview. As for obtaining clearance on your own, you cannot do it. While the clearance does belong to do and will follow you if you change jobs, you cannot get cleared on your own. Only your company/government agency can request it for you.
But exactly what happens depends entirely on the specific job and the level of clearance required.
I interviewed with and was hired by a department within the US Army CECOM as my first job out of college. The job required CONFIDENTIAL clearance, which I did not posses. I was still allowed to start working while my clearance was pending.
At the same time, I had friends on base who actually required SECRET (or better) clearance that actually were forced to work in an off-site location while their clearance was being processed. Usually that work was only tangentially related to their job since their actual job involved stuff they could not access without their clearance.
The short version is we were all hired without the appropriate clearance. But were still allowed to being working while the clearance process went through. How detailed the investigation is also depends on what level of clearance is needed. Mine was a simple questionnaire and references (who were also sent a questionnaire), but higher levels of clearance will require more thorough investigations. My experience is as long as you are 100% honest on your history and you don't have any major red flags (a criminal record, ties to terrorists organizations, etc), you should be ok.
Now, if the job requires previous security clearance (whether it is an active or inactive/lapsed clearance), it is unlikely you would get the job as it usually indicates the company is unwilling to wait for the clearance process or does not want to pay the costs associated with getting you cleared (the second one usually does not apply to government agencies and only to government contractors).