Treat an octopus as you would a very sensitive coral, and keep lots of carbon filtration on the system, because if it decides to ink in your tank, the recirculating ink will be toxic for the octopus as well as anyone else in the tank. If you can, get a day octopus, since they are supposed to be more inquisitive and come out more. Octopi are very sensitive to conditions in your tank, so make sure it's in great shape before you get your octopus.
Environments will differ from one octopus to the next. Blue rings are often tidepool inhabitants, while larger octopi are sometimes deep water dwellers. Some reside in sandy areas with lots of rock formations, others will live in shell beds. A common theme for all octopi is that they love to hide. You must give them shelter so that they can escape from your site. Once, they get acclimated to your presence (which could be never) they will come out more often.
A common problem is the right food source for them. I had 2 types of octopi, a blue ring, and a common brown octopus. The blue ring died after a couple of weeks, and the brown lasted for about half a year until I was on vacation and the tank sitter unplugged everything (killing my octopus and my reef, what a tragedy). Neither ever ate ghost shrimp (no interest) and neither tackled guppies either. However, they really enjoyed fiddler crabs (I bought a bunch of them from a LFS for $50 for 50) and this became their staple.
Octopi are also definitely escape artists. In mine, had a 20 long drilled for an overflow, then I siliconed the glass hood down to the tank, cutting a hole in the back for a return. The front was also siliconed along the edges for a snug tight fit, so there was absolutely no space for them to escape. Octopi are notoriously intelligent, and will figure out a way to escape if you give them the slightest hole.
These are very specialized animals and also very intelligent. Don't try and get one unless you are an expert, and are willing to have a pet that you may not ever see. Even though they are incredibly cool, when you see one at the LFS, often you are only seeing it because it is has not been given a place to hide, and it is very stressed out. If this is the case, it could easily die in the bag by inking on your way home.
Again, I cannot stress enough, unless you're an expert, don't get an octopus.