Before you replace your chandelier or light with a ceiling fan, you need to know that the electric junction box in the ceiling is rated to support your fan. All new fan boxes manufactured today are marked if they are fan rated and will have special barrel post for the fan screws.
If you are unsure if your electric box is fan rated it is best to replace with one you know for sure is properly rated. Remember it is your safety at risk here!
There are many different styles of boxes made to day, some that will straddle a joist some with bars that span between the ceiling joists and others that are screwed to the side of the joists. Part depends on whether you are working on the support system with an open ceiling or closed, with or without access from above.
If you have the ceiling open where you can access the joist, use a box that attches directly to the joist provided it will be in the location you want it, it it is not where you want it you can use a bar box that spans across the joists.
If the ceiling is not open, but you have access from above, a side mount or bar mount can be used.
If the ceiling is closed here is a video showing how to install a bar box designed just for this situation.