From the wiki:
Saplings can grow into trees when placed on dirt, podzol or a grass block. Oak, birch, and (normal) spruce can also grow on farmland, and 2×2 trees only check for dirt or grass under the northwestern-most sapling.
The sapling requires a light level of at least 9, and require a certain amount of space around the sapling, based on its type:
- Oak needs at least 5 spaces above
- Birch needs at least 6 spaces above
- Spruce needs at least 7 spaces above when placing a single sapling
- Giant spruce needs at least 14 spaces above when planted as 4 saplings in a 2×2 square
- Jungle needs at least 5 spaces above when placing a single sapling
- Giant jungle needs at least 11 spaces above and 1 space adjacent when planted as 4 saplings in a 2×2 square
- Acacia needs at least 6 spaces above
- Dark Oak needs at least 7 spaces above and must be planted as 4 saplings in a 2×2 square
Single and Giant trees will not grow when they have an adjacent block next to them above ground, including half blocks.
Single trees will allow objects to be placed at their diagonals without impeding growth, Giant will not. Oak trees ignore adjacent blocks and will grow anyway, provided there is enough space above.
These are the minimum requirements. Larger gaps then the minimum appear to cause the trees to grow faster and/or need less bone meal. If these minimum requirements are met, they will grow 100% of the time. I have grown trees right next to each other.
Don't forget that saplings need a light level of 9 or higher. Growing too many trees close together can block light from getting to a sapling.
Also, oak saplings ignore the adjacent blocks and will grow anyway. They can be grown right next to walls. Do not try to stop their upward growth with dirt though, as they will grow through dirt and replace it with wood trunks.
Here is an image of oak saplings and then them grown into trees next to each other:
More extreme, here is giant spruce: