tl;dr- Libertarians believe in individuals' right to enter into agreements, not technical compliance with written documents. Ideally, written documents would serve as evidence of actual agreements, having no intrinsic legal effect beyond that.
In addition to @WesSayeed's excellent answer...
Libertarians fundamentally believe in agreements between consenting parties. There's no fundamental reason that such agreements need to be written up; in principle, it's sufficient that all parties to a contract comply with it.
In reality, contractual parties may dispute others' compliance with a contract. In order to resolve disputes, it's extremely helpful to have evidence of the contractual arrangement. Written documents are meant to serve as such evidence.
Regarding the example in the question
Also, what about if you buy a software, and some terms in the software TOS says that you agree to be sex slave.
In this hypothetical scenario, is the sex-slave clause buried in a part of the section that a reasonable mediator would find likely to have been hidden and thus not representative of what the software customer actually agreed to? If so, then a Libertarian would tend to argue that it should be invalid; that the piece of paper itself isn't sufficient evidence of an actual agreement about sex slavery.
Practically speaking, it's often difficult to establish the absolute truth in conflict resolution. When there's disagreement about the truth, things become less ideal and practical concerns come in. It's then a question of attempting to ensure compliance to the all parties' differing perceptions of the agreement as-best-as-possible, potentially discounting the perceptions of parties who were negligent or otherwise not acting in good faith.
So in an ideal Libertarian society, those entering into agreements would want to ensure that they have sufficient evidence of actual agreement rather than just a signed document that contains a point somewhere within it. Presumably people couldn't just get out of contracts by claiming to have not actually inspected them, as that'd be negligence (poor faith) on their part, though presumably people wouldn't tend to be fully obligated to meet obligations that a judge would find to be insufficiently evidenced assuming due diligence, where "due diligence" would tend to vary with the context – for example, the due diligence to carefully inspect a contract for installing common software would presumably be fairly low as software customers would tend to have a reasonable expectation for such contracts to not contain a clause about being a sex slave.
Real-life contractual law seems to contain elements of this
It's my understanding that contract law tends to work somewhat like this in many countries, e.g. the US.
This appears to be a huge topic; as a starting point:
In English law, a vitiating factor in the common law of contract is a factor that can affect the validity of a contract. The concept has been adopted in other common law jurisdictions, including the USA.
–"Vitiating factors in the law of contract", Wikipedia
My impression is that (not legal advice):
Courts can hold contractual clauses invalid when they seem to be in bad faith.
"There are controls on what we call unfair terms," says Prof Hoernle.
She says: "Clearly the courts now take into account that if there are unfair clauses hidden away in terms of service, it's more likely to be [deemed] unfair.
–"Is small print in online contracts enforceable?", BBC News (2013-06-06)
Some legal documents require signing/initialing individual pages/clauses to strengthen the evidence of actual agreement to certain terms.
When a contractual agreement seems particularly unusual, it'd be advisable to obtain stronger evidence of the agreement than just having parties sign at the end.
"The user has to be made aware of the terms of service and if there are any unusual or surprising terms of service, they have to be pointed out specifically to the consumer."
–"Is small print in online contracts enforceable?", BBC News (2013-06-06)
Note: On forced compliance in the presence of negligence
Say that someone blindly signs a contract without reading it. Then, should they be forced to comply with it?
Under typical law, yes. And under Libertarian logic, yes. But the reasons are very different, so wanted to clarify the distinction here.
In the Libertarian logic described above, if someone blindly signs a contract and can prove that they signed it without actual agreement, then that contract doesn't serve as evidence of an actual agreement and wouldn't be enforceable.
However, by having signed the contract, they'd have tricked the other contractual parties into believing that the blind-signer agreed. So while it'd be unfair to say that the blind-signer actually agreed, it's entirely accurate to say that they've defrauded the other contractual parties. Then as restitution for their fraudulent behavior, it'd be reasonable to require them to meet the apparent contractual terms.
The point here's just that the Libertarian logic works and reaches a very similar conclusion, though the path to that conclusion's different.