Here is one method:
If the points of a line segment are P_1 and P_2 then the line segment can be described as P_1+t(P_2-P_1). Assuming P_1 and P_2 are the endpoints of the segment, t is between 0 and 1.
This means that any point on the segment can be written (x(t),y(t),z(t)).
Using the same system we can write the second line segment as (x'(s),y'(s),z'(s)).
The lines intersect if and only if there exists a value for s and t such that these points are the same. This point will be the point of intersection.
Solving the system of equations:
x(t) = x'(s)
y(t) = y'(s)
z(t) = z'(s)
will yield the point of intersection. If there are no solutions, the lines do not intersect.