Being offside can happen for a number of reasons.

I'm writing this at the end of my first season of rugby, playing at lock (often called Second Row, as you are in the second row of the scrum) for my high school club team, so bear with me if I omit anything.

Like football, there is a line of scrimmage in Rugby - well, more accurately, two lines of scrimmage, one for the offense and one for the defense. If you're on offense, the line of scrimmage can be one of two things, depending on where the ball is. If the ball is in the hands of one of your teammates, the line of scrimmage is that player. You have to be behind the player with the ball, and since, in order to make a legal pass, you must be passing behind you, after one makes a pass they generally slow down, while someone recieving a pass speeds up to burst past the other player and "get him onside."

The other line of scrimmage for the offense exists only when the ball has been kicked by one of your teammates. In that case, the line of scrimmage is the guy who kicked the ball - even when the other team catches it. So if you're near your goal line and make a stop, your team winding up with the ball, and your fly half kicks it downfield to give your team some breathing room but misses the kick for touch (meaning he was intending to kick the ball out of bounds without having it bounce inbounds first, which, when kicking after a penalty, awards a line out to your side where the ball first went out and always gives your side breathing room), and the other team catches it, your fly half must then sprint from where he is to the very front of your line, so that everyone is behind him. Once everyone is behind him, the line of scrimmage is the opposition with the ball. If you were to make a tackle while you were in front of the guy who kicked the ball, then as soon as play got slow a scrum with advantage to the opposition would be awarded near where the tackle was made (or not, depending on the rules you're playing by - these are men's high school rules I'm going off of).

For the defense, the line of scrimmage is the ball, unless one of your teammates has made a tackle. In that case, the line of scrimmage is the back foot of the defender who made the tackle. In order to get in on a ruck or maul you must be bound in with your teammate, which basically means tackle him as well as the guy on the other team. Otherwise you have to make yourself ready off to one side of the action, behind the back foot of the ruck or maul, which is known as fringing.

When a ruck happens, the opposition has gone to ground and presented the ball to his teammates. You don't want them to get the ball. In this case, you can knock them off the ball thus moving your team's line of scrimmage over the ball in a process known as rucking over. Usually two guys ruck over, and to do so, you simply pick up some speed and hit the guy on the other team who's either:

a. being stupid and going for the ball or

b. trying to ruck you over so his team's scrumhalf can safely get the ball out to the backs.

So long as you've wrapped up on the guy, you can push to your heart's content. This is what really forms the ruck and the ruck is the line of scrimmage - because if you're the forward most defender and you're involved in the ruck, after you're past the ball, the ball is behind your line of scrimmage, see?

Its my understanding that you can't enter a ruck or maul from the side, that's offsides. You must enter from the back of your side of the ruck or maul. That's why, when you watch rugby, if the maul isn't goin anywhere one of the guys on the side will unbind, back up, pick up some speed and knock into the rear again - he's being pushed out and offsides.

I hope this covers most of the offsides issue in Rugby! Or at least, what I understand as rugby.