Shouldn't the shortest path function take me from a random source id to a random target id?
Yes, pgRouting's shortest_path can route from one vertex to another vertex (if there is a valid connection of course).
in my db i have a gid for every line, plus a source and target id for that line
How did you assign source and target id's? Did you use assign_vertex_id()?
It sounds like there is no valid connection between the start and end points you tested.
Does pgrouting understand intersections between lines?
No. There has to be a vertex at the intersection, otherwise it will not be recognized.
Update:
In this case though, gid:1 is intersecting gid:2 but I guess a vertex is not properly created
So you have two lines crossing each other? You need to split at the intersection (resulting in four lines) if you want to be able to turn on this intersection. Otherwise it's interpreted as an over-/under-pass.