John,
We don't store the return URL in a session variable. We did at one point, but that causes some issues on sites with page caching enabled, so we started just passing the original URL that the Login with LinkedIn button was clicked from in the actual Login URL as the return=xyz parameter. It's encoded, but can be easily decoded to take the user back to the original page if that's how JLinked is configured.
The login flow is mainly in the /components/com_jlinked/controllers/loginregister.php file in the function login(). That's actually entered from the /com_jlinked/controller.php file, which determines if the user already has an account on the site or not. If so, it uses the login() function, if not, it redirects them to the Login/Register page. The actual check for what redirection is performed is actually in the /models/loginregister.php file in the getLoginRedirect() function.
As for how to control the user flow through the site based on previous actions, I don't really have any great suggestions there. That's a difficult thing to control when you have a bunch of different extensions installed on the site. Were you just trying to redirect the user to a different page based on something they did before logging in, or something even more in-depth based on past actions when they've been on the site?
Hope that helps,
Alex