MAX function and group by usage - postgresql
This might get you started:

select name,
       (reviews_count / reviews_count + max_reviews_count) * rating + (max_reviews_count / (reviews_count+max_reviews_count) * avg_rating) AS ranking
from (
  SELECT name,
         reviews_count,
         rating, 
         MAX(reviews_count) over () as max_reviews_count,
         AVG(rating) over() as avg_rating
  FROM businesses
) t;


Note that I removed the nullif to make it easier to read. 

I'm not sure the use of the window functions is totally correct. I guess you need to do some grouping in there. If that is the case, then add this to the over() clause, e.g. over(partition by name) 

The partition by in a window function is essentially a group by without the need to group the whole result. 

For more details on window functions, please see the manual: http://www.postgresql.org/docs/current/static/tutorial-window.html