The cash value is a portion of what you've paid in. Usually, you must pay in for several years before there's any cash value at all.
There is only cash value in whole life insurance policies, not term life insurance.
You have to have a cash value policy from which to borrow. It usually takes several years to build up any cash value in a whole life insurance policy.
Then, when you want to take out a loan from your whole life policy you fill out a form requesting whatever amount you want up to the available amount in your policy. Usually, you can borrow up to 80-95% of the cash value in your life insurance plan.
Here's how you can learn more about whole life insurance and how it works.