|Generally you can rest once every 30 minutes (real time). Some inns will rent you a room. If you do this, you can rest in your room regardless of the last time you rested.
When resting outside an inn, you may need either a bedroll or a campfire. To use the bedroll, just rest - it happens automatically. To use a campfire, build the campfire (using oak wood) and then get close to it and rest.
Certain races and classes can rest in certain areas without needing a bedroll or a campfire.
Druids and rangers can rest in forests or plains without needing a bedroll or campfire.
Elves and Scouts can rest in forests without needing a bedroll or campfire.
Dwarves can rest in any underground area without needing a bedroll or campfire.
However note that you can still only rest every 30 minutes outside of an inn room.
Resting in dangerous areas may attract monsters to your location.