You can't deduct the purchase price of a rental in the year you buy it. Instead, the cost of the building (not the land) is recovered a little each year through depreciation. For US residential rental property, that is generally straight-line over 27.5 years, starting when the property is placed in service as a rental.
Improvements that add value or extend the property's life, such as a new roof, are depreciated too, while ordinary repairs are usually deducted in the year they're paid. The line between a repair and an improvement matters, and it is one of the most common questions at tax time.
Depreciation is calculated on Form 4562 and flows to Schedule E. When the property is sold, depreciation taken (or allowable) is generally recaptured and taxed. This is general information, not tax advice; a tax professional can set up the schedule for your property.
Free resource: Rental property expense categories.