Basicaly it's simple. If the script is static, for example: javascript (which you will find the most used static script) you simply write in the code the following:
<script type='javascript'< (here comes the script> </script>
or if your script is in a separate page write this:
<script type='javascript' src='(path to script file)'> </script>
A tutorial to javascript can be found here:
http://www.w3schools.com/js/default.asp
If the script is dinamic (like php,perl,asp...) you need to have the page hosted on a server that support that knows to parse that kind of script. More can befound here:
http://www.w3schools.com/