Lettuce is a half-hardy annual. That means it will survive light frosts but will die as soon as it sets seed. It's particular about the soil temperature when it germinates. It is definitely a cool weather crop and the seed won't germinate at all in temperatures above 80 degrees.
It prefers a rich, well-drained soil with a PH of at least 6.0. It does best if you can give it full sun in the morning but partial shade in the heat of the afternoon. Try planting it in an east to west oriented raised bed with a trellis affixed to the west end of it. Plant a sun-loving vine, such as cucumber, to grow up the trellis.
Plant it in cold frames very early in the season and again very late in the season. It will winter over even in very cold climates if the cold frame is well-insulated.
If you don't have a cold frame, try planting a small block of lettuce about a month before your first frost and just before the frost hits surround the planting with four straw bales. Cover the top opening with an old window or a piece of plexiglass. Instant cold frame. Just keep an eye out for rodents making homes in the straw and eating your lettuces.
Heat will also cause the plant to set seed (called bolting). Once lettuce bolts, it becomes bitter and tough. Most gardeners pull it out at that point. I usually continue to harvest it for about a week after it bolts. It's no longer suitable for use as a salad but it's perfectly acceptable when cooked. If yours bolts, you can try saving the seeds.
You can also intersperse blocks of lettuce between blocks of taller crops, such as twig- trellised or bush peas, in wide rows.
Lettuce takes well to hydroponic growing so that you can enjoy it fresh year round and even if you have no space outside for a garden.