let us assume we have a picklist with 3 different values one value of three values be "other".If other picklist value is selected in the drop down one text box to be opened to enter the value of the other specified type.If the remaining two values are selected in the picklist the text box should be locked.if only other picklist value selected the text box should be able to enter the value.
If done in a VF Page, textbox can be disabled which can restrict a user in entering a value.
Else, If you are working on a standard detail page. You can achieve this via a Validation rule, which can make sure that a user enters a value when required. And that textbox would be always in ENABLED mode which would be optional while any values are selected.
ISPICKVAL(PicklistField,'Other') & ISBLANK(TextboxField) - This will throw an error if textbox is left blank when other is selected.
You can also set a validation rule if you want the textbox to be left blank for any values in picklist.