Petra is a world-renowned site, and an amazing place. However it is also quite touristy, and many people come to Jordan for a 3-days or a 1 week trip, just to visit Petra, Wadi Rum, and one more site like Aqaba or Amman. The daily price to enter Petra is therefore huge (70JD) for one day, but this can be reduced by buying a Jordan pass which is 70JD for one day in Petra, and includes your entry Visa. You can also get in and stay at Petra for free.
Take a lot of water because shops charge a crazy price for bottles. You can drink the water from the toilets but it tastes very bad.
Get in free
It is a big site and the only entrance is located in such a way that you can't easily avoid it. But before arriving to Petra, go out of the city Wadi Musa, and take the road on the right that leads to the Bedouin village Um Sayhun which is visible just northwest of Wadi Musa on Google Maps. Walking on the road, Petra is now on your left and a bit behind you. Half way to the Bedouin village, right around the sign that says that "Entry into Petra from this point is prohibited", go off the road into the canyons and avoid as much as you can being noticed. Voice carries for miles down there os whisper to your mates if you want to keep a low profile, which you should. From there walk into the canyons until you find the right one, at some points small and narrow. Descend down to the canyon floor as early as you can to avoid dangerous canyons and cliffs. You might have to climb up and down a little bit, but then you are on site. The walk can take an hour or two. During winter months you may find yourself trekking through mud and puddles of trapped rain water at the bottom of canyons, so be prepared to get dirty. There are a few bedouin tents along this way - they will surely notice you entering and the kids will most likely run over to have a friendly chat. Best thing to do is to be friendly, practice your Arabic, give them some pretzels, and say "Asalam Aleikum!"
Once on the site, it is advised not to hang out too much with the locals because people from security are more likely to ask for you tickets then: they would not suspect people alone, 'normal tourists' to have found a passage by themselves without the help of a local. If you are asked for your ticket, pretend until the end that you have lost it or you have thrown it away because there is a fine for sneaking in. During the winter months you are highly unlikely to encounter any authority figures or employees on the inside, only bedouins and vendors so it's quite safe and enjoyable, albeit a very challenging trek with plenty of opportunities to die if you're not a competent climber.
When you want to leave just take the main entrance/exit.
You can also go into Petra from the Bedouin village, this is how the locals working in Petra come. It is much easier but is well a known way and if you look like a foreigner, you may get spotted from far away and caught easily.
Officially, you are not allowed to stay the night in Petra. However, if you make friends with the Bedouin then you will very quickly be asked to stay in one of their caves. If you are walking through with a big pack and look a little bit hippy they may call you over, if not then start talking with them. Most tourists ignore the Bedouin, so treating them like people instead of scenery will go a long way! They will likely give you arak and hashish, and may ask you to pay some small price to help them out with food and vices for the evening. This is less practical in the off season since it's cold at night.