Petra is a world-reknowned site, and an amazing place. However it is also quite touristy, and many people come to Jordan for a 3-days or one week trip, just to visit Petra, the Wadi Rum and one more thing. 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 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. Walking on the road, Petra is now on your left and a bit behind you. Half way to the Bedouin village, go off the road to the canyons and avoid as much as you can being noticed. From there walk into the canyons until you find the right one, at some points small and narrow. 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. This part is actually known as 'Little Petra', and seems to be where more of the Bedouin live.
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 find a passage by themselves without 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.
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.