how do you use a raycast and what is it used for
There are many different applications for ray casting.
its basically what it says: you define a starting point and a direction. Then an imaginary line is drawn with these parameters. If the line at some point intersects with a collider, you get a hit object which tells you exactly what was hit and where (world position), and the length of the Ray (line).
This can for example be used to find out if an object is in the player’s line of sight, or to check distances (distance from player to edge of a cube). Also in a shooter you can use it to check if the enemy was hit without having to simulate a physical bullet.
Since I often work on mouse based games, I use it mostly to detect mouse clicks on objects and get the exact position where it was clicked.
for more information check out the script reference (raycast can only be used in scripting):
http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=raycast